support _NET_NUMBER_OF_DESKTOPS message so you can change number of

2002-03-10  Havoc Pennington  <hp@pobox.com>

	* src/display.c (event_callback): support _NET_NUMBER_OF_DESKTOPS
	message so you can change number of desktops with the pager

	* src/prefs.c (meta_prefs_set_num_workspaces): new function

	* src/display.c (meta_spew_event): print stacking aspects of
	configure request
This commit is contained in:
Havoc Pennington 2002-03-10 18:36:08 +00:00 committed by Havoc Pennington
parent 447eba6007
commit 35a2f2df76
4 changed files with 80 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2002-03-10 Havoc Pennington <hp@pobox.com>
* src/display.c (event_callback): support _NET_NUMBER_OF_DESKTOPS
message so you can change number of desktops with the pager
* src/prefs.c (meta_prefs_set_num_workspaces): new function
* src/display.c (meta_spew_event): print stacking aspects of
configure requests
2002-03-10 Havoc Pennington <hp@pobox.com>
* src/screen.c (set_supported_hint): we didn't claim to support

View File

@ -1252,6 +1252,18 @@ event_callback (XEvent *event,
else
meta_verbose ("Don't know about workspace %d\n", space);
}
else if (event->xclient.message_type ==
display->atom_net_number_of_desktops)
{
int num_spaces;
num_spaces = event->xclient.data.l[0];
meta_verbose ("Request to set number of workspaces to %d\n",
num_spaces);
meta_prefs_set_num_workspaces (num_spaces);
}
else if (event->xclient.message_type ==
display->atom_metacity_restart_message)
{
@ -1497,6 +1509,26 @@ meta_event_mode_to_string (int m)
return mode;
}
const char*
stack_mode_to_string (int mode)
{
switch (mode)
{
case Above:
return "Above";
case Below:
return "Below";
case TopIf:
return "TopIf";
case BottomIf:
return "BottomIf";
case Opposite:
return "Opposite";
}
return "Unknown";
}
static char*
key_event_description (Display *xdisplay,
XEvent *event)
@ -1622,7 +1654,7 @@ meta_spew_event (MetaDisplay *display,
break;
case ConfigureRequest:
name = "ConfigureRequest";
extra = g_strdup_printf ("parent: 0x%lx window: 0x%lx x: %d %sy: %d %sw: %d %sh: %d %sborder: %d %s",
extra = g_strdup_printf ("parent: 0x%lx window: 0x%lx x: %d %sy: %d %sw: %d %sh: %d %sborder: %d %sabove: %lx %sstackmode: %lx %s",
event->xconfigurerequest.parent,
event->xconfigurerequest.window,
event->xconfigurerequest.x,
@ -1639,7 +1671,13 @@ meta_spew_event (MetaDisplay *display,
CWHeight ? "" : "(unset) ",
event->xconfigurerequest.border_width,
event->xconfigurerequest.value_mask &
CWBorderWidth ? "" : "(unset)");
CWBorderWidth ? "" : "(unset)",
event->xconfigurerequest.above,
event->xconfigurerequest.value_mask &
CWSibling ? "" : "(unset)",
stack_mode_to_string (event->xconfigurerequest.detail),
event->xconfigurerequest.value_mask &
CWStackMode ? "" : "(unset)");
break;
case GravityNotify:
name = "GravityNotify";

View File

@ -614,3 +614,31 @@ meta_preference_to_string (MetaPreference pref)
return "(unknown)";
}
void
meta_prefs_set_num_workspaces (int n_workspaces)
{
GError *err;
if (default_client == NULL)
return;
if (n_workspaces < 1)
n_workspaces = 1;
if (n_workspaces > MAX_REASONABLE_WORKSPACES)
n_workspaces = MAX_REASONABLE_WORKSPACES;
err = NULL;
gconf_client_set_int (default_client,
KEY_NUM_WORKSPACES,
n_workspaces,
&err);
if (err)
{
meta_warning (_("Error setting number of workspaces to %d: %s\n"),
num_workspaces,
err->message);
g_error_free (err);
}
}

View File

@ -56,6 +56,8 @@ int meta_prefs_get_titlebar_font_size (void);
int meta_prefs_get_num_workspaces (void);
gboolean meta_prefs_get_application_based (void);
void meta_prefs_set_num_workspaces (int n_workspaces);
#endif