fix problem with finalizing non-initialized fully display when failing to
Tue Apr 30 14:23:43 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix problem with finalizing non-initialized fully display when failing to open display. * tests/testxinerama.c: Xinerama test case from multihead branch, with some cleanups. (Start even if there is only one monitor, for one.)
This commit is contained in:
		
							
								
								
									
										10
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ChangeLog
									
									
									
									
									
								
							@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					Tue Apr 30 14:23:43 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix
 | 
				
			||||||
 | 
						problem with finalizing non-initialized fully display
 | 
				
			||||||
 | 
						when failing to open display.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* tests/testxinerama.c: Xinerama test case from
 | 
				
			||||||
 | 
						multihead branch, with some cleanups. (Start even
 | 
				
			||||||
 | 
						if there is only one monitor, for one.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
					Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
						* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					Tue Apr 30 14:23:43 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix
 | 
				
			||||||
 | 
						problem with finalizing non-initialized fully display
 | 
				
			||||||
 | 
						when failing to open display.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* tests/testxinerama.c: Xinerama test case from
 | 
				
			||||||
 | 
						multihead branch, with some cleanups. (Start even
 | 
				
			||||||
 | 
						if there is only one monitor, for one.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
					Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
						* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					Tue Apr 30 14:23:43 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix
 | 
				
			||||||
 | 
						problem with finalizing non-initialized fully display
 | 
				
			||||||
 | 
						when failing to open display.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* tests/testxinerama.c: Xinerama test case from
 | 
				
			||||||
 | 
						multihead branch, with some cleanups. (Start even
 | 
				
			||||||
 | 
						if there is only one monitor, for one.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
					Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
						* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					Tue Apr 30 14:23:43 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix
 | 
				
			||||||
 | 
						problem with finalizing non-initialized fully display
 | 
				
			||||||
 | 
						when failing to open display.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* tests/testxinerama.c: Xinerama test case from
 | 
				
			||||||
 | 
						multihead branch, with some cleanups. (Start even
 | 
				
			||||||
 | 
						if there is only one monitor, for one.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
					Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
						* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					Tue Apr 30 14:23:43 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix
 | 
				
			||||||
 | 
						problem with finalizing non-initialized fully display
 | 
				
			||||||
 | 
						when failing to open display.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* tests/testxinerama.c: Xinerama test case from
 | 
				
			||||||
 | 
						multihead branch, with some cleanups. (Start even
 | 
				
			||||||
 | 
						if there is only one monitor, for one.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
					Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
						* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,13 @@
 | 
				
			|||||||
 | 
					Tue Apr 30 14:23:43 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* gdk/x11/gdkdisplay-x11.c (gdk_open_display): fix
 | 
				
			||||||
 | 
						problem with finalizing non-initialized fully display
 | 
				
			||||||
 | 
						when failing to open display.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* tests/testxinerama.c: Xinerama test case from
 | 
				
			||||||
 | 
						multihead branch, with some cleanups. (Start even
 | 
				
			||||||
 | 
						if there is only one monitor, for one.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
					Tue Apr 30 14:15:14 2002  Owen Taylor  <otaylor@redhat.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
						* gtk/gtkfilesel.c gtk/gtkselection.c: Doc fixes.
 | 
				
			||||||
 | 
				
			|||||||
@ -216,6 +216,7 @@ init_xinerama_support (GdkScreen * screen)
 | 
				
			|||||||
GdkDisplay *
 | 
					GdkDisplay *
 | 
				
			||||||
gdk_open_display (const gchar *display_name)
 | 
					gdk_open_display (const gchar *display_name)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  Display *xdisplay;
 | 
				
			||||||
  GdkDisplay *display;
 | 
					  GdkDisplay *display;
 | 
				
			||||||
  GdkDisplayX11 *display_x11;
 | 
					  GdkDisplayX11 *display_x11;
 | 
				
			||||||
  gint argc;
 | 
					  gint argc;
 | 
				
			||||||
@ -226,17 +227,15 @@ gdk_open_display (const gchar *display_name)
 | 
				
			|||||||
  gulong pid;
 | 
					  gulong pid;
 | 
				
			||||||
  gint i;
 | 
					  gint i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  xdisplay = XOpenDisplay (display_name);
 | 
				
			||||||
 | 
					  if (!xdisplay)
 | 
				
			||||||
 | 
					    return NULL;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL);
 | 
					  display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL);
 | 
				
			||||||
  display_x11 = GDK_DISPLAY_X11 (display);
 | 
					  display_x11 = GDK_DISPLAY_X11 (display);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  display_x11->use_xft = -1;
 | 
					  display_x11->use_xft = -1;
 | 
				
			||||||
  display_x11->xdisplay = XOpenDisplay (display_name);
 | 
					  display_x11->xdisplay = xdisplay;
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  if (!display_x11->xdisplay)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      g_object_unref (display);
 | 
					 | 
				
			||||||
      return NULL;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  /* populate the screen list and set default */
 | 
					  /* populate the screen list and set default */
 | 
				
			||||||
  for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
 | 
					  for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
 | 
				
			||||||
 | 
				
			|||||||
@ -41,7 +41,8 @@ noinst_PROGRAMS = 		\
 | 
				
			|||||||
	testtreeflow		\
 | 
						testtreeflow		\
 | 
				
			||||||
	testtreecolumns		\
 | 
						testtreecolumns		\
 | 
				
			||||||
	testtreesort		\
 | 
						testtreesort		\
 | 
				
			||||||
	treestoretest
 | 
						treestoretest		\
 | 
				
			||||||
 | 
						testxinerama
 | 
				
			||||||
 | 
					
 | 
				
			||||||
simple_DEPENDENCIES = $(TEST_DEPS)
 | 
					simple_DEPENDENCIES = $(TEST_DEPS)
 | 
				
			||||||
testcalendar_DEPENDENCIES = $(TEST_DEPS)
 | 
					testcalendar_DEPENDENCIES = $(TEST_DEPS)
 | 
				
			||||||
@ -61,6 +62,7 @@ testtreeflow_DEPENDENCIES = $(DEPS)
 | 
				
			|||||||
testtreecolumns_DEPENDENCIES = $(DEPS)
 | 
					testtreecolumns_DEPENDENCIES = $(DEPS)
 | 
				
			||||||
testtreesort_DEPENDENCIES = $(DEPS)
 | 
					testtreesort_DEPENDENCIES = $(DEPS)
 | 
				
			||||||
treestoretest_DEPENDENCIES = $(TEST_DEPS)
 | 
					treestoretest_DEPENDENCIES = $(TEST_DEPS)
 | 
				
			||||||
 | 
					testxinerama_DEPENDENCIES = $(TEST_DEPS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
simple_LDADD = $(LDADDS)
 | 
					simple_LDADD = $(LDADDS)
 | 
				
			||||||
testcalendar_LDADD = $(LDADDS)
 | 
					testcalendar_LDADD = $(LDADDS)
 | 
				
			||||||
@ -80,6 +82,7 @@ testtreecolumns_LDADD = $(LDADDS)
 | 
				
			|||||||
testtreesort_LDADD = $(LDADDS)
 | 
					testtreesort_LDADD = $(LDADDS)
 | 
				
			||||||
testtext_LDADD = $(LDADDS)
 | 
					testtext_LDADD = $(LDADDS)
 | 
				
			||||||
treestoretest_LDADD = $(LDADDS)
 | 
					treestoretest_LDADD = $(LDADDS)
 | 
				
			||||||
 | 
					testxinerama_LDADD = $(LDADDS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
testgtk_SOURCES =	\
 | 
					testgtk_SOURCES =	\
 | 
				
			||||||
	prop-editor.c   \
 | 
						prop-editor.c   \
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										79
									
								
								tests/testxinerama.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								tests/testxinerama.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,79 @@
 | 
				
			|||||||
 | 
					#include <stdlib.h>
 | 
				
			||||||
 | 
					#include <gtk/gtk.h>
 | 
				
			||||||
 | 
					#include "x11/gdkx.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static gint num_monitors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void
 | 
				
			||||||
 | 
					request (GtkWidget      *widget,
 | 
				
			||||||
 | 
						 GdkEventMotion *event,
 | 
				
			||||||
 | 
						 gpointer        user_data)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  gchar *str;
 | 
				
			||||||
 | 
					  gint i = gdk_screen_get_monitor_at_window (gtk_widget_get_screen (widget),
 | 
				
			||||||
 | 
										     GDK_WINDOW_XWINDOW (widget->window));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (i < 0)
 | 
				
			||||||
 | 
					    str = g_strdup ("<big><span foreground='white' background='black'>Not on a monitor </span></big>");
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      GdkRectangle *monitor = gdk_screen_get_monitor_geometry (gtk_widget_get_screen (widget), i);
 | 
				
			||||||
 | 
					      str = g_strdup_printf ("<big><span foreground='white' background='black'>"
 | 
				
			||||||
 | 
								     "Monitor %d of %d</span></big>\n"
 | 
				
			||||||
 | 
								     "<i>Width - Height       </i>: (%d,%d)\n"
 | 
				
			||||||
 | 
								     "<i>Top left coordinate </i>: (%d,%d)",i+1, num_monitors,
 | 
				
			||||||
 | 
								     monitor->width, monitor->height, monitor->x, monitor->y);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  gtk_label_set_markup (GTK_LABEL (user_data), str);
 | 
				
			||||||
 | 
					  g_free (str);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int
 | 
				
			||||||
 | 
					main (int argc, char *argv[])
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  GtkWidget *window, *label, *vbox, *button;
 | 
				
			||||||
 | 
					  GdkScreen *screen;
 | 
				
			||||||
 | 
					  gint i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  gtk_init (&argc, &argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  screen = gdk_get_default_screen ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  num_monitors = gdk_screen_get_n_monitors (screen);
 | 
				
			||||||
 | 
					  if (num_monitors == 1)
 | 
				
			||||||
 | 
					    g_warning ("The current display has only one monitor.");
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  for (i=0; i<num_monitors; i++)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      GdkRectangle *monitor = gdk_screen_get_monitor_geometry (screen, i);
 | 
				
			||||||
 | 
					      gchar *str;
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
 | 
				
			||||||
 | 
					      gtk_window_move (GTK_WINDOW (window), (monitor->width - 200) / 2 + monitor->x,
 | 
				
			||||||
 | 
							       (monitor->height - 200) / 2 + monitor->y);
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
 | 
					      label = gtk_label_new (NULL);
 | 
				
			||||||
 | 
					      str = g_strdup_printf ("<big><span foreground='white' background='black'>"
 | 
				
			||||||
 | 
								     "Monitor %d of %d</span></big>\n"
 | 
				
			||||||
 | 
								     "<i>Width - Height       </i>: (%d,%d)\n"
 | 
				
			||||||
 | 
								     "<i>Top left coordinate </i>: (%d,%d)",i+1, num_monitors,
 | 
				
			||||||
 | 
								     monitor->width, monitor->height, monitor->x, monitor->y);
 | 
				
			||||||
 | 
					      gtk_label_set_markup (GTK_LABEL (label), str);
 | 
				
			||||||
 | 
					      g_free (str);
 | 
				
			||||||
 | 
					      button = gtk_button_new_with_label ("Close");
 | 
				
			||||||
 | 
					      g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (gtk_main_quit), NULL);
 | 
				
			||||||
 | 
					      g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (request), label);
 | 
				
			||||||
 | 
					      vbox = gtk_vbox_new (TRUE, 1);
 | 
				
			||||||
 | 
					      gtk_container_add (GTK_CONTAINER (window), vbox);
 | 
				
			||||||
 | 
					      gtk_container_add (GTK_CONTAINER (vbox), label);
 | 
				
			||||||
 | 
					      gtk_container_add (GTK_CONTAINER (vbox), button);
 | 
				
			||||||
 | 
					      gtk_widget_show_all (window);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  gtk_main ();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user