Fix an off-by-one error.

2002-05-06  Anders Carlsson  <andersca@gnu.org>

	* src/display.c: (set_utf8_string_hint):
	Fix an off-by-one error.

	(meta_display_open),
	(event_callback), (meta_display_update_show_desktop_hint),
	(meta_display_show_desktop), (meta_display_unshow_desktop):
	* src/display.h:
	* src/screen.c: (set_supported_hint):
	Add support for _NET_WM_SHOW desktop, both as a message and
	as a root window property.
This commit is contained in:
Anders Carlsson 2002-05-06 06:11:46 +00:00 committed by Anders Carlsson
parent 41120f2a79
commit 7b9877258f
4 changed files with 62 additions and 3 deletions

View File

@ -1,3 +1,16 @@
2002-05-06 Anders Carlsson <andersca@gnu.org>
* src/display.c: (set_utf8_string_hint):
Fix an off-by-one error.
(meta_display_open),
(event_callback), (meta_display_update_show_desktop_hint),
(meta_display_show_desktop), (meta_display_unshow_desktop):
* src/display.h:
* src/screen.c: (set_supported_hint):
Add support for _NET_WM_SHOW desktop, both as a message and
as a root window property.
2002-05-05 Havoc Pennington <hp@pobox.com> 2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue * src/window.c (meta_window_unminimize): on unminimize, queue

View File

@ -93,7 +93,7 @@ set_utf8_string_hint (MetaDisplay *display,
XChangeProperty (display->xdisplay, XChangeProperty (display->xdisplay,
xwindow, atom, xwindow, atom,
display->atom_utf8_string, display->atom_utf8_string,
8, PropModeReplace, (guchar*) val, strlen (val) + 1); 8, PropModeReplace, (guchar*) val, strlen (val));
return meta_error_trap_pop (display); return meta_error_trap_pop (display);
} }
@ -205,7 +205,8 @@ meta_display_open (const char *name)
"_NET_WM_PING", "_NET_WM_PING",
"_NET_WM_PID", "_NET_WM_PID",
"WM_CLIENT_MACHINE", "WM_CLIENT_MACHINE",
"_NET_WM_WORKAREA" "_NET_WM_WORKAREA",
"_NET_WM_SHOW_DESKTOP"
}; };
Atom atoms[G_N_ELEMENTS(atom_names)]; Atom atoms[G_N_ELEMENTS(atom_names)];
@ -313,6 +314,7 @@ meta_display_open (const char *name)
display->atom_net_wm_pid = atoms[54]; display->atom_net_wm_pid = atoms[54];
display->atom_wm_client_machine = atoms[55]; display->atom_wm_client_machine = atoms[55];
display->atom_net_wm_workarea = atoms[56]; display->atom_net_wm_workarea = atoms[56];
display->atom_net_wm_show_desktop = atoms[57];
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK, /* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new * created in screen_new
@ -1264,6 +1266,19 @@ event_callback (XEvent *event,
meta_prefs_set_num_workspaces (num_spaces); meta_prefs_set_num_workspaces (num_spaces);
} }
else if (event->xclient.message_type ==
display->atom_net_wm_show_desktop)
{
gboolean show_desktop;
show_desktop = event->xclient.data.l[0] != 0;
meta_verbose ("Request to %s desktop\n", show_desktop ? "show" : "hide");
if (show_desktop)
meta_display_show_desktop (display);
else
meta_display_unshow_desktop (display);
}
else if (event->xclient.message_type == else if (event->xclient.message_type ==
display->atom_metacity_restart_message) display->atom_metacity_restart_message)
{ {
@ -2268,6 +2283,31 @@ meta_display_increment_event_serial (MetaDisplay *display)
display->atom_motif_wm_hints); display->atom_motif_wm_hints);
} }
static void
meta_display_update_show_desktop_hint (MetaDisplay *display)
{
GSList *tmp;
unsigned long data[1];
data[0] = display->showing_desktop ? 1 : 0;
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_error_trap_push (display);
XChangeProperty (display->xdisplay, screen->xroot,
display->atom_net_wm_show_desktop,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (display);
tmp = tmp->next;
}
}
void void
meta_display_update_active_window_hint (MetaDisplay *display) meta_display_update_active_window_hint (MetaDisplay *display)
{ {
@ -2326,6 +2366,8 @@ meta_display_show_desktop (MetaDisplay *display)
display->showing_desktop = TRUE; display->showing_desktop = TRUE;
queue_windows_showing (display); queue_windows_showing (display);
meta_display_update_show_desktop_hint (display);
} }
void void
@ -2337,6 +2379,8 @@ meta_display_unshow_desktop (MetaDisplay *display)
display->showing_desktop = FALSE; display->showing_desktop = FALSE;
queue_windows_showing (display); queue_windows_showing (display);
meta_display_update_show_desktop_hint (display);
} }
void void

View File

@ -129,6 +129,7 @@ struct _MetaDisplay
Atom atom_wm_client_machine; Atom atom_wm_client_machine;
Atom atom_net_wm_state_fullscreen; Atom atom_net_wm_state_fullscreen;
Atom atom_net_wm_workarea; Atom atom_net_wm_workarea;
Atom atom_net_wm_show_desktop;
/* This is the actual window from focus events, /* This is the actual window from focus events,
* not the one we last set * not the one we last set

View File

@ -82,7 +82,7 @@ set_wm_check_hint (MetaScreen *screen)
static int static int
set_supported_hint (MetaScreen *screen) set_supported_hint (MetaScreen *screen)
{ {
#define N_SUPPORTED 30 #define N_SUPPORTED 31
#define N_WIN_SUPPORTED 1 #define N_WIN_SUPPORTED 1
Atom atoms[N_SUPPORTED]; Atom atoms[N_SUPPORTED];
@ -116,6 +116,7 @@ set_supported_hint (MetaScreen *screen)
atoms[27] = screen->display->atom_net_wm_ping; atoms[27] = screen->display->atom_net_wm_ping;
atoms[28] = screen->display->atom_net_active_window; atoms[28] = screen->display->atom_net_active_window;
atoms[29] = screen->display->atom_net_wm_workarea; atoms[29] = screen->display->atom_net_wm_workarea;
atoms[30] = screen->display->atom_net_wm_show_desktop;
XChangeProperty (screen->display->xdisplay, screen->xroot, XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_net_supported, screen->display->atom_net_supported,