diff --git a/ChangeLog b/ChangeLog index b09035e1d..56a948f9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-03-10 Havoc Pennington + + * 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 * src/screen.c (set_supported_hint): we didn't claim to support diff --git a/src/display.c b/src/display.c index 0ea81ad73..bf6c4a554 100644 --- a/src/display.c +++ b/src/display.c @@ -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"; diff --git a/src/prefs.c b/src/prefs.c index 90177d466..ba898f587 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -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); + } +} diff --git a/src/prefs.h b/src/prefs.h index 617d73074..0684dd2ca 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -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