Patch from Erwann Chenede.

Thu Jun 20 15:53:21 2002  Owen Taylor  <otaylor@redhat.com>

	Patch from Erwann Chenede.

	* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
	Introduce a yes/no/unknown GdkTristate, use it
	in a couple of places. (#79962)

	* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
	gravity_works per-display. (#79963)
This commit is contained in:
Owen Taylor 2002-06-20 19:59:30 +00:00 committed by Owen Taylor
parent 511d536a4b
commit 4251a51edc
9 changed files with 91 additions and 17 deletions

View File

@ -1,3 +1,14 @@
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
Introduce a yes/no/unknown GdkTristate, use it
in a couple of places. (#79962)
* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
gravity_works per-display. (#79963)
Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_owner_set): Get * gtk/gtkselection.c (gtk_selection_owner_set): Get

View File

@ -1,3 +1,14 @@
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
Introduce a yes/no/unknown GdkTristate, use it
in a couple of places. (#79962)
* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
gravity_works per-display. (#79963)
Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_owner_set): Get * gtk/gtkselection.c (gtk_selection_owner_set): Get

View File

@ -1,3 +1,14 @@
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
Introduce a yes/no/unknown GdkTristate, use it
in a couple of places. (#79962)
* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
gravity_works per-display. (#79963)
Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_owner_set): Get * gtk/gtkselection.c (gtk_selection_owner_set): Get

View File

@ -1,3 +1,14 @@
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
Introduce a yes/no/unknown GdkTristate, use it
in a couple of places. (#79962)
* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
gravity_works per-display. (#79963)
Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_owner_set): Get * gtk/gtkselection.c (gtk_selection_owner_set): Get

View File

@ -1,3 +1,14 @@
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
Introduce a yes/no/unknown GdkTristate, use it
in a couple of places. (#79962)
* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
gravity_works per-display. (#79963)
Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_owner_set): Get * gtk/gtkselection.c (gtk_selection_owner_set): Get

View File

@ -1,3 +1,14 @@
Thu Jun 20 15:53:21 2002 Owen Taylor <otaylor@redhat.com>
Patch from Erwann Chenede.
* gdk/x11/gdkdisplay-x11.[ch] gdk/x11/gdkprivate-x11.h:
Introduce a yes/no/unknown GdkTristate, use it
in a couple of places. (#79962)
* gdk/x11/gdkwindow-x11.c gdk/x11/gdkdisplay-x11.h: Make
gravity_works per-display. (#79963)
Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com> Thu Jun 20 15:36:40 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_owner_set): Get * gtk/gtkselection.c (gtk_selection_owner_set): Get

View File

@ -132,8 +132,9 @@ gdk_open_display (const gchar *display_name)
display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)]; display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
display_x11->leader_window = XCreateSimpleWindow (display_x11->xdisplay, display_x11->leader_window = XCreateSimpleWindow (display_x11->xdisplay,
GDK_SCREEN_X11 (display_x11->default_screen)->xroot_window, GDK_SCREEN_X11 (display_x11->default_screen)->xroot_window,
10, 10, 10, 10, 0, 0, 0); 10, 10, 10, 10, 0, 0, 0);
display_x11->have_shape = GDK_UNKNOWN;
display_x11->gravity_works = GDK_UNKNOWN;
if (_gdk_synchronize) if (_gdk_synchronize)
XSynchronize (display_x11->xdisplay, True); XSynchronize (display_x11->xdisplay, True);
@ -198,6 +199,8 @@ gdk_open_display (const gchar *display_name)
_gdk_input_init (display); _gdk_input_init (display);
_gdk_dnd_init (display); _gdk_dnd_init (display);
g_signal_emit_by_name (gdk_library_get(), "display_opened", display);
return display; return display;
} }

View File

@ -44,6 +44,13 @@ typedef struct _GdkDisplayX11Class GdkDisplayX11Class;
#define GDK_IS_DISPLAY_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_X11)) #define GDK_IS_DISPLAY_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_X11))
#define GDK_DISPLAY_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class)) #define GDK_DISPLAY_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class))
typedef enum
{
GDK_UNKNOWN,
GDK_NO,
GDK_YES
} GdkTristate;
struct _GdkDisplayX11 struct _GdkDisplayX11
{ {
GdkDisplay parent_instance; GdkDisplay parent_instance;
@ -68,7 +75,8 @@ struct _GdkDisplayX11
gboolean use_xshm; gboolean use_xshm;
gboolean have_shm_pixmaps; gboolean have_shm_pixmaps;
gint have_shape; GdkTristate have_shape;
GdkTristate gravity_works;
/* Information about current pointer and keyboard grabs held by this /* Information about current pointer and keyboard grabs held by this
* client. If gdk_pointer_xgrab_window or gdk_keyboard_xgrab_window * client. If gdk_pointer_xgrab_window or gdk_keyboard_xgrab_window

View File

@ -2666,23 +2666,22 @@ gdk_window_add_colormap_windows (GdkWindow *window)
static gboolean static gboolean
gdk_window_have_shape_ext (GdkDisplay *display) gdk_window_have_shape_ext (GdkDisplay *display)
{ {
enum { UNKNOWN, NO, YES };
GdkDisplayX11 *display_x11; GdkDisplayX11 *display_x11;
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
display_x11 = GDK_DISPLAY_X11 (display); display_x11 = GDK_DISPLAY_X11 (display);
if (display_x11->have_shape == UNKNOWN) if (display_x11->have_shape == GDK_UNKNOWN)
{ {
int ignore; int ignore;
if (XQueryExtension (display_x11->xdisplay, "SHAPE", &ignore, &ignore, &ignore)) if (XQueryExtension (display_x11->xdisplay, "SHAPE", &ignore, &ignore, &ignore))
display_x11->have_shape = YES; display_x11->have_shape = GDK_YES;
else else
display_x11->have_shape = NO; display_x11->have_shape = GDK_NO;
} }
return (display_x11->have_shape == YES); return (display_x11->have_shape == GDK_YES);
} }
#define WARN_SHAPE_TOO_BIG() g_warning ("GdkWindow is too large to allow the use of shape masks or shape regions.") #define WARN_SHAPE_TOO_BIG() g_warning ("GdkWindow is too large to allow the use of shape masks or shape regions.")
@ -3943,11 +3942,9 @@ gdk_window_merge_child_shapes (GdkWindow *window)
static gboolean static gboolean
gdk_window_gravity_works (GdkWindow *window) gdk_window_gravity_works (GdkWindow *window)
{ {
enum { UNKNOWN, NO, YES }; GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_DRAWABLE_DISPLAY (window));
static gint gravity_works = UNKNOWN;
GdkDisplay *display = GDK_DRAWABLE_DISPLAY (window);
if (gravity_works == UNKNOWN) if (display_x11->gravity_works == GDK_UNKNOWN)
{ {
GdkWindowAttr attr; GdkWindowAttr attr;
GdkWindow *parent; GdkWindow *parent;
@ -3957,11 +3954,11 @@ gdk_window_gravity_works (GdkWindow *window)
/* This particular server apparently has a bug so that the test /* This particular server apparently has a bug so that the test
* works but the actual code crashes it * works but the actual code crashes it
*/ */
if ((!strcmp (XServerVendor (GDK_DISPLAY_XDISPLAY (display)), if ((!strcmp (XServerVendor (display_x11->xdisplay),
"Sun Microsystems, Inc.")) && "Sun Microsystems, Inc.")) &&
(VendorRelease (GDK_DISPLAY_XDISPLAY (display)) == 3400)) (VendorRelease (display_x11->xdisplay) == 3400))
{ {
gravity_works = NO; display_x11->gravity_works = GDK_NO;
return FALSE; return FALSE;
} }
@ -3995,10 +3992,10 @@ gdk_window_gravity_works (GdkWindow *window)
gdk_window_destroy (parent); gdk_window_destroy (parent);
gdk_window_destroy (child); gdk_window_destroy (child);
gravity_works = ((y == -20) ? YES : NO); display_x11->gravity_works = ((y == -20) ? GDK_YES : GDK_NO);
} }
return (gravity_works == YES); return (display_x11->gravity_works == GDK_YES);
} }
static void static void