Commit 1689117c authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

fix GtkWindowMnemonic to have a separate typedef

2002-09-24  Havoc Pennington  <hp@redhat.com>

	* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
	typedef

	* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
	FULLSCREEN state

	* tests/testgtk.c (get_state_controls): add
	fullscreen/unfullscreen test

	* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable

	* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
	variable

	* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
	variable

	* gdk/x11/gdkscreen-x11.c
	(_gdk_x11_screen_window_manager_changed): emit
	window_manager_changed signal

	* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
	window_manager_changed signal

	* gdk/x11/gdkevents-x11.c
	(gdk_x11_screen_get_window_manager_name): new function

	* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
	skip_taskbar_hint, skip_pager_hint properties
	(gtk_window_set_skip_taskbar_hint):
	(gtk_window_get_skip_taskbar_hint):
	(gtk_window_set_skip_pager_hint):
	(gtk_window_get_skip_pager_hint):
	(gtk_window_fullscreen):
	(gtk_window_unfullscreen): new functions

	* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state

	* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
	values

	* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
	(gdk_window_set_skip_pager_hint):
	(gdk_window_fullscreen):
	(gdk_window_unfullscreen): new functions
	(set_initial_hints): set fullscreen here if appropriate
parent d41f210d
2002-09-24 Havoc Pennington <hp@redhat.com>
* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
typedef
* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
FULLSCREEN state
* tests/testgtk.c (get_state_controls): add
fullscreen/unfullscreen test
* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable
* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
variable
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
variable
* gdk/x11/gdkscreen-x11.c
(_gdk_x11_screen_window_manager_changed): emit
window_manager_changed signal
* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
window_manager_changed signal
* gdk/x11/gdkevents-x11.c
(gdk_x11_screen_get_window_manager_name): new function
* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
skip_taskbar_hint, skip_pager_hint properties
(gtk_window_set_skip_taskbar_hint):
(gtk_window_get_skip_taskbar_hint):
(gtk_window_set_skip_pager_hint):
(gtk_window_get_skip_pager_hint):
(gtk_window_fullscreen):
(gtk_window_unfullscreen): new functions
* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state
* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
values
* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
(gdk_window_set_skip_pager_hint):
(gdk_window_fullscreen):
(gdk_window_unfullscreen): new functions
(set_initial_hints): set fullscreen here if appropriate
Wed Sep 25 10:51:24 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkscreen.h gdk/{x11,win32,linux-fb}/gdkscreen-*.c:
......
2002-09-24 Havoc Pennington <hp@redhat.com>
* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
typedef
* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
FULLSCREEN state
* tests/testgtk.c (get_state_controls): add
fullscreen/unfullscreen test
* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable
* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
variable
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
variable
* gdk/x11/gdkscreen-x11.c
(_gdk_x11_screen_window_manager_changed): emit
window_manager_changed signal
* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
window_manager_changed signal
* gdk/x11/gdkevents-x11.c
(gdk_x11_screen_get_window_manager_name): new function
* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
skip_taskbar_hint, skip_pager_hint properties
(gtk_window_set_skip_taskbar_hint):
(gtk_window_get_skip_taskbar_hint):
(gtk_window_set_skip_pager_hint):
(gtk_window_get_skip_pager_hint):
(gtk_window_fullscreen):
(gtk_window_unfullscreen): new functions
* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state
* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
values
* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
(gdk_window_set_skip_pager_hint):
(gdk_window_fullscreen):
(gdk_window_unfullscreen): new functions
(set_initial_hints): set fullscreen here if appropriate
Wed Sep 25 10:51:24 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkscreen.h gdk/{x11,win32,linux-fb}/gdkscreen-*.c:
......
2002-09-24 Havoc Pennington <hp@redhat.com>
* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
typedef
* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
FULLSCREEN state
* tests/testgtk.c (get_state_controls): add
fullscreen/unfullscreen test
* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable
* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
variable
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
variable
* gdk/x11/gdkscreen-x11.c
(_gdk_x11_screen_window_manager_changed): emit
window_manager_changed signal
* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
window_manager_changed signal
* gdk/x11/gdkevents-x11.c
(gdk_x11_screen_get_window_manager_name): new function
* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
skip_taskbar_hint, skip_pager_hint properties
(gtk_window_set_skip_taskbar_hint):
(gtk_window_get_skip_taskbar_hint):
(gtk_window_set_skip_pager_hint):
(gtk_window_get_skip_pager_hint):
(gtk_window_fullscreen):
(gtk_window_unfullscreen): new functions
* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state
* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
values
* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
(gdk_window_set_skip_pager_hint):
(gdk_window_fullscreen):
(gdk_window_unfullscreen): new functions
(set_initial_hints): set fullscreen here if appropriate
Wed Sep 25 10:51:24 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkscreen.h gdk/{x11,win32,linux-fb}/gdkscreen-*.c:
......
2002-09-24 Havoc Pennington <hp@redhat.com>
* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
typedef
* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
FULLSCREEN state
* tests/testgtk.c (get_state_controls): add
fullscreen/unfullscreen test
* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable
* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
variable
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
variable
* gdk/x11/gdkscreen-x11.c
(_gdk_x11_screen_window_manager_changed): emit
window_manager_changed signal
* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
window_manager_changed signal
* gdk/x11/gdkevents-x11.c
(gdk_x11_screen_get_window_manager_name): new function
* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
skip_taskbar_hint, skip_pager_hint properties
(gtk_window_set_skip_taskbar_hint):
(gtk_window_get_skip_taskbar_hint):
(gtk_window_set_skip_pager_hint):
(gtk_window_get_skip_pager_hint):
(gtk_window_fullscreen):
(gtk_window_unfullscreen): new functions
* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state
* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
values
* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
(gdk_window_set_skip_pager_hint):
(gdk_window_fullscreen):
(gdk_window_unfullscreen): new functions
(set_initial_hints): set fullscreen here if appropriate
Wed Sep 25 10:51:24 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkscreen.h gdk/{x11,win32,linux-fb}/gdkscreen-*.c:
......
2002-09-24 Havoc Pennington <hp@redhat.com>
* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
typedef
* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
FULLSCREEN state
* tests/testgtk.c (get_state_controls): add
fullscreen/unfullscreen test
* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable
* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
variable
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
variable
* gdk/x11/gdkscreen-x11.c
(_gdk_x11_screen_window_manager_changed): emit
window_manager_changed signal
* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
window_manager_changed signal
* gdk/x11/gdkevents-x11.c
(gdk_x11_screen_get_window_manager_name): new function
* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
skip_taskbar_hint, skip_pager_hint properties
(gtk_window_set_skip_taskbar_hint):
(gtk_window_get_skip_taskbar_hint):
(gtk_window_set_skip_pager_hint):
(gtk_window_get_skip_pager_hint):
(gtk_window_fullscreen):
(gtk_window_unfullscreen): new functions
* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state
* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
values
* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
(gdk_window_set_skip_pager_hint):
(gdk_window_fullscreen):
(gdk_window_unfullscreen): new functions
(set_initial_hints): set fullscreen here if appropriate
Wed Sep 25 10:51:24 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkscreen.h gdk/{x11,win32,linux-fb}/gdkscreen-*.c:
......
2002-09-24 Havoc Pennington <hp@redhat.com>
* gtk/gtkwindow.c: fix GtkWindowMnemonic to have a separate
typedef
* gdk/x11/gdkevents-x11.c (gdk_check_wm_state_changed): monitor
FULLSCREEN state
* tests/testgtk.c (get_state_controls): add
fullscreen/unfullscreen test
* gdk/gdkdisplay.c (gdk_display_finalize): fix unused variable
* gdk/x11/gdkscreen-x11.c (init_xinerama_support): fix unused
variable
* gdk/x11/gdkevents-x11.c (gdk_xsettings_watch_cb): mop up unused
variable
* gdk/x11/gdkscreen-x11.c
(_gdk_x11_screen_window_manager_changed): emit
window_manager_changed signal
* gdk/x11/gdkscreen-x11.h (struct _GdkScreenX11Class): add
window_manager_changed signal
* gdk/x11/gdkevents-x11.c
(gdk_x11_screen_get_window_manager_name): new function
* gtk/gtkwindow.c (gtk_window_class_init): add type_hint,
skip_taskbar_hint, skip_pager_hint properties
(gtk_window_set_skip_taskbar_hint):
(gtk_window_get_skip_taskbar_hint):
(gtk_window_set_skip_pager_hint):
(gtk_window_get_skip_pager_hint):
(gtk_window_fullscreen):
(gtk_window_unfullscreen): new functions
* gdk/gdkevents.h (GdkWindowState): add FULLSCREEN state
* gdk/gdkwindow.h (GdkWindowTypeHint): add missing type hint
values
* gdk/x11/gdkwindow-x11.c (gdk_window_set_skip_taskbar_hint):
(gdk_window_set_skip_pager_hint):
(gdk_window_fullscreen):
(gdk_window_unfullscreen): new functions
(set_initial_hints): set fullscreen here if appropriate
Wed Sep 25 10:51:24 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkscreen.h gdk/{x11,win32,linux-fb}/gdkscreen-*.c:
......
......@@ -121,8 +121,6 @@ gdk_display_dispose (GObject *object)
static void
gdk_display_finalize (GObject *object)
{
GdkDisplay *display = GDK_DISPLAY_OBJECT (object);
parent_class->finalize (object);
}
......
......@@ -201,10 +201,11 @@ typedef enum
typedef enum
{
GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
GDK_WINDOW_STATE_STICKY = 1 << 3
GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
GDK_WINDOW_STATE_ICONIFIED = 1 << 1,
GDK_WINDOW_STATE_MAXIMIZED = 1 << 2,
GDK_WINDOW_STATE_STICKY = 1 << 3,
GDK_WINDOW_STATE_FULLSCREEN = 1 << 4
} GdkWindowState;
typedef enum
......
......@@ -104,7 +104,11 @@ typedef enum
GDK_WINDOW_TYPE_HINT_NORMAL,
GDK_WINDOW_TYPE_HINT_DIALOG,
GDK_WINDOW_TYPE_HINT_MENU,
GDK_WINDOW_TYPE_HINT_TOOLBAR
GDK_WINDOW_TYPE_HINT_TOOLBAR,
GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
GDK_WINDOW_TYPE_HINT_UTILITY,
GDK_WINDOW_TYPE_HINT_DOCK,
GDK_WINDOW_TYPE_HINT_DESKTOP
} GdkWindowTypeHint;
......@@ -396,10 +400,16 @@ void gdk_window_set_hints (GdkWindow *window,
gint max_height,
gint flags);
#endif
void gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint);
void gdk_window_set_modal_hint (GdkWindow *window,
gboolean modal);
void gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint);
void gdk_window_set_modal_hint (GdkWindow *window,
gboolean modal);
void gdk_window_set_skip_taskbar_hint (GdkWindow *window,
gboolean skips_taskbar);
void gdk_window_set_skip_pager_hint (GdkWindow *window,
gboolean skips_pager);
void gdk_window_set_geometry_hints (GdkWindow *window,
GdkGeometry *geometry,
GdkWindowHints geom_mask);
......@@ -490,6 +500,8 @@ void gdk_window_stick (GdkWindow *window);
void gdk_window_unstick (GdkWindow *window);
void gdk_window_maximize (GdkWindow *window);
void gdk_window_unmaximize (GdkWindow *window);
void gdk_window_fullscreen (GdkWindow *window);
void gdk_window_unfullscreen (GdkWindow *window);
void gdk_window_register_dnd (GdkWindow *window);
......
......@@ -364,7 +364,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
gulong bytes_after;
Atom *atoms = NULL;
gulong i;
gboolean found_sticky, found_maxvert, found_maxhorz;
gboolean found_sticky, found_maxvert, found_maxhorz, found_fullscreen;
GdkWindowState old_state;
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
......@@ -375,6 +375,7 @@ gdk_check_wm_state_changed (GdkWindow *window)
found_sticky = FALSE;
found_maxvert = FALSE;
found_maxhorz = FALSE;
found_fullscreen = FALSE;
XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
......@@ -386,7 +387,8 @@ gdk_check_wm_state_changed (GdkWindow *window)
Atom sticky_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_STICKY");
Atom maxvert_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT");
Atom maxhorz_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
Atom fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN");
i = 0;
while (i < nitems)
{
......@@ -396,7 +398,9 @@ gdk_check_wm_state_changed (GdkWindow *window)
found_maxvert = TRUE;
else if (atoms[i] == maxhorz_atom)
found_maxhorz = TRUE;
else if (atoms[i] == fullscreen_atom)
found_fullscreen = TRUE;
++i;
}
......@@ -444,6 +448,21 @@ gdk_check_wm_state_changed (GdkWindow *window)
GDK_WINDOW_STATE_STICKY);
}
if (old_state & GDK_WINDOW_STATE_FULLSCREEN)
{
if (!found_fullscreen)
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_FULLSCREEN,
0);
}
else
{
if (found_fullscreen)
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_FULLSCREEN);
}
/* Our "maximized" means both vertical and horizontal; if only one,
* we don't expose that via GDK
*/
......@@ -607,7 +626,14 @@ gdk_event_translate (GdkDisplay *display,
xevent->xany.window == screen_x11->wmspec_check_window)
{
if (xevent->type == DestroyNotify)
screen_x11->wmspec_check_window = None;
{
screen_x11->wmspec_check_window = None;
g_free (screen_x11->window_manager_name);
screen_x11->window_manager_name = g_strdup ("unknown");
/* careful, reentrancy */
_gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));
}
/* Eat events on this window unless someone had wrapped
* it as a foreign window
......@@ -2052,6 +2078,108 @@ gdk_x11_get_server_time (GdkWindow *window)
return xevent.xproperty.time;
}
static void
fetch_net_wm_check_window (GdkScreen *screen)
{
GdkScreenX11 *screen_x11;
GdkDisplay *display;
Atom type;
gint format;
gulong n_items;
gulong bytes_after;
Window *xwindow;
/* This function is very slow on every call if you are not running a
* spec-supporting WM. For now not optimized, because it isn't in
* any critical code paths, but if you used it somewhere that had to
* be fast you want to avoid "GTK is slow with old WMs" complaints.
* Probably at that point the function should be changed to query
* _NET_SUPPORTING_WM_CHECK only once every 10 seconds or something.
*/
screen_x11 = GDK_SCREEN_X11 (screen);
display = screen_x11->display;
if (screen_x11->wmspec_check_window != None)
return; /* already have it */
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
&n_items, &bytes_after, (guchar **) & xwindow);
if (type != XA_WINDOW)
return;
gdk_error_trap_push ();
/* Find out if this WM goes away, so we can reset everything. */
XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask);
screen_x11->wmspec_check_window = *xwindow;
XFree (xwindow);
screen_x11->need_refetch_net_supported = TRUE;
screen_x11->need_refetch_wm_name = TRUE;
/* Careful, reentrancy */
_gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));
}
const char*
gdk_x11_screen_get_window_manager_name (GdkScreen *screen)
{
GdkScreenX11 *screen_x11;
screen_x11 = GDK_SCREEN_X11 (screen);
fetch_net_wm_check_window (screen);
if (screen_x11->need_refetch_wm_name)
{
/* Get the name of the window manager */
screen_x11->need_refetch_wm_name = FALSE;
g_free (screen_x11->window_manager_name);
screen_x11->window_manager_name = g_strdup ("unknown");
if (screen_x11->wmspec_check_window != None)
{
Atom type;
gint format;
gulong n_items;
gulong bytes_after;
guchar *name;
name = NULL;
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (screen_x11->display),
screen_x11->wmspec_check_window,
gdk_x11_get_xatom_by_name_for_display (screen_x11->display,
"_NET_WM_NAME"),
0, G_MAXLONG, False,
gdk_x11_get_xatom_by_name_for_display (screen_x11->display,
"UTF8_STRING"),
&type, &format,
&n_items, &bytes_after,
(guchar **)&name);
gdk_display_sync (screen_x11->display);
gdk_error_trap_pop ();
if (name != NULL)
{
g_free (screen_x11->window_manager_name);
screen_x11->window_manager_name = g_strdup (name);
XFree (name);
}
}
}
return GDK_SCREEN_X11 (screen)->window_manager_name;
}
typedef struct _NetWmSupportedAtoms NetWmSupportedAtoms;
struct _NetWmSupportedAtoms
......@@ -2076,6 +2204,8 @@ struct _NetWmSupportedAtoms
* is that your application can start up before the window manager
* does when the user logs in, and before the window manager starts
* gdk_x11_screen_supports_net_wm_hint() will return %FALSE for every property.
* You can monitor the window_manager_changed signal on #GdkScreen to detect
* a window manager change.
*
* Return value: %TRUE if the window manager supports @property
**/
......@@ -2083,11 +2213,6 @@ gboolean
gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
GdkAtom property)
{
Atom type;
gint format;
gulong nitems;
gulong bytes_after;
Window *xwindow;
gulong i;
GdkScreenX11 *screen_x11;
NetWmSupportedAtoms *supported_atoms;
......@@ -2105,72 +2230,51 @@ gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
g_object_set_data (G_OBJECT (screen), "gdk-net-wm-supported-atoms", supported_atoms);
}
if (screen_x11->wmspec_check_window != None)
fetch_net_wm_check_window (screen);
if (screen_x11->wmspec_check_window == None)
return FALSE;
if (screen_x11->need_refetch_net_supported)
{
if (supported_atoms->atoms == NULL)
return FALSE;
/* WM has changed since we last got the supported list,
* refetch it.
*/
Atom type;
gint format;
gulong bytes_after;
screen_x11->need_refetch_net_supported = FALSE;
i = 0;
while (i < supported_atoms->n_atoms)
{
if (supported_atoms->atoms[i] == gdk_x11_atom_to_xatom_for_display (display, property))
return TRUE;
++i;
}
if (supported_atoms->atoms)
XFree (supported_atoms->atoms);
return FALSE;
supported_atoms->atoms = NULL;
supported_atoms->n_atoms = 0;
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTED"),
0, G_MAXLONG, False, XA_ATOM, &type, &format,
&supported_atoms->n_atoms, &bytes_after,
(guchar **)&supported_atoms->atoms);
if (type != XA_ATOM)
return FALSE;
}
if (supported_atoms->atoms)
XFree (supported_atoms->atoms);
supported_atoms->atoms = NULL;
supported_atoms->n_atoms = 0;
/* This function is very slow on every call if you are not running a
* spec-supporting WM. For now not optimized, because it isn't in
* any critical code paths, but if you used it somewhere that had to
* be fast you want to avoid "GTK is slow with old WMs" complaints.
* Probably at that point the function should be changed to query
* _NET_SUPPORTING_WM_CHECK only once every 10 seconds or something.
*/
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
0, G_MAXLONG, False, XA_WINDOW, &type, &format,
&nitems, &bytes_after, (guchar **) & xwindow);
if (type != XA_WINDOW)
if (supported_atoms->atoms == NULL)
return FALSE;
gdk_error_trap_push ();
/* Find out if this WM goes away, so we can reset everything. */
XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask);
gdk_display_sync (screen_x11->display);
if (gdk_error_trap_pop ())
i = 0;
while (i < supported_atoms->n_atoms)
{
XFree (xwindow);
return FALSE;
if (supported_atoms->atoms[i] == gdk_x11_atom_to_xatom_for_display (display, property))
return TRUE;
++i;
}
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTED"),
0, G_MAXLONG, False, XA_ATOM, &type, &format,
&supported_atoms->n_atoms, &bytes_after,
(guchar **)&supported_atoms->atoms);
if (type != XA_ATOM)
return FALSE;
screen_x11->wmspec_check_window = *xwindow;
XFree (xwindow);
/* since wmspec_check_window != None this isn't infinite. ;-) */
return gdk_x11_screen_supports_net_wm_hint (screen, property);
return FALSE;
}
/**
......@@ -2393,7 +2497,6 @@ gdk_xsettings_watch_cb (Window window,
{
GdkWindow *gdkwin;
GdkScreen *screen = cb_data;
GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
gdkwin = gdk_window_lookup_for_display (gdk_screen_get_display (screen), window);
......
......@@ -46,8 +46,14 @@ static void gdk_screen_x11_dispose (GObject *object);
static void gdk_screen_x11_finalize (GObject *object);
static void init_xinerama_support (GdkScreen *screen);
enum
{
WINDOW_MANAGER_CHANGED,
LAST_SIGNAL
};
static gpointer parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
_gdk_screen_x11_get_type ()
......@@ -84,6 +90,16 @@ gdk_screen_x11_class_init (GdkScreenX11Class *klass)
object_class->finalize = gdk_screen_x11_finalize;
parent_class = g_type_class_peek_parent (klass);
signals[WINDOW_MANAGER_CHANGED] =
g_signal_new ("window_manager_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkScreenX11Class, window_manager_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
}
/**
......@@ -247,7 +263,7 @@ gdk_screen_x11_dispose (GObject *object)
screen_x11->screen_num = -1;
screen_x11->xroot_window = None;
screen_x11->wmspec_check_window = None;
G_OBJECT_CLASS (parent_class)->dispose (object);
}
......@@ -264,10 +280,12 @@ gdk_screen_x11_finalize (GObject *object)
g_object_unref (screen_x11->visuals[i]);*/
g_free (screen_x11->visuals);
g_hash_table_destroy (screen_x11->visual_hash);
g_free (screen_x11->window_manager_name);
g_hash_table_destroy (screen_x11->colormap_hash);
/* X settings */
g_free (screen_x11->xsettings_client);
g_free (screen_x11->monitors);
G_OBJECT_CLASS (parent_class)->finalize (object);
......@@ -360,7 +378,9 @@ _gdk_x11_screen_new (GdkDisplay *display,
screen_x11->screen_num = screen_number;
screen_x11->xroot_window = RootWindow (display_x11->xdisplay,screen_number);