diff --git a/ChangeLog b/ChangeLog index d45f64d18..4dd91eafd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2002-06-25 Mark McLoughlin + + * src/display.[ch]: (meta_display_open): + src/screen.c: (set_supported_hint), (set_work_area_hint): + Its _NET_WORKAREA, not _NET_WM_WORKAREA silly :-) + +2002-06-25 Mark McLoughlin + + * src/screen.[ch]: + (update_num_workspaces), recalc workarea hint when + new workspaces created. Fixes bug that workarea + not calculated until first non-dock window is + mapped. + (set_work_area_hint), (set_work_area_idle_func), + (meta_screen_queue_workarea_recalc): move all this + stuff from workspace.c. + + * src/workspace.c: (meta_workspace_invalidate_work_area): + use meta_screen_queue_workarea_recalc. + 2002-06-23 Gediminas Paulauskas * src/themes/Bright/metacity-theme-1.xml: Update with border-only diff --git a/src/display.c b/src/display.c index d08d2f20c..74160c6f6 100644 --- a/src/display.c +++ b/src/display.c @@ -218,7 +218,7 @@ meta_display_open (const char *name) "_NET_WM_PING", "_NET_WM_PID", "WM_CLIENT_MACHINE", - "_NET_WM_WORKAREA", + "_NET_WORKAREA", "_NET_SHOW_DESKTOP", "_NET_DESKTOP_LAYOUT", "MANAGER", @@ -348,7 +348,7 @@ meta_display_open (const char *name) display->atom_net_wm_ping = atoms[53]; display->atom_net_wm_pid = atoms[54]; display->atom_wm_client_machine = atoms[55]; - display->atom_net_wm_workarea = atoms[56]; + display->atom_net_workarea = atoms[56]; display->atom_net_show_desktop = atoms[57]; display->atom_net_desktop_layout = atoms[58]; display->atom_manager = atoms[59]; diff --git a/src/display.h b/src/display.h index 4620030f8..0f03c950f 100644 --- a/src/display.h +++ b/src/display.h @@ -128,7 +128,7 @@ struct _MetaDisplay Atom atom_net_wm_pid; Atom atom_wm_client_machine; Atom atom_net_wm_state_fullscreen; - Atom atom_net_wm_workarea; + Atom atom_net_workarea; Atom atom_net_show_desktop; Atom atom_net_desktop_layout; Atom atom_manager; diff --git a/src/screen.c b/src/screen.c index b5d6473c6..65ecbe73f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -114,7 +114,7 @@ set_supported_hint (MetaScreen *screen) atoms[26] = screen->display->atom_net_wm_state_fullscreen; atoms[27] = screen->display->atom_net_wm_ping; atoms[28] = screen->display->atom_net_active_window; - atoms[29] = screen->display->atom_net_wm_workarea; + atoms[29] = screen->display->atom_net_workarea; atoms[30] = screen->display->atom_net_show_desktop; atoms[31] = screen->display->atom_net_desktop_layout; atoms[32] = screen->display->atom_net_desktop_names; @@ -815,6 +815,8 @@ update_num_workspaces (MetaScreen *screen) meta_workspace_new (screen); ++i; } + + meta_screen_queue_workarea_recalc (screen); } static void @@ -1252,6 +1254,75 @@ meta_create_offscreen_window (Display *xdisplay, &attrs); } +static int +set_work_area_hint (MetaScreen *screen) +{ + int num_workspaces; + GList *tmp_list; + unsigned long *data, *tmp; + MetaRectangle area; + + num_workspaces = meta_screen_get_n_workspaces (screen); + data = g_new (unsigned long, num_workspaces * 4); + tmp_list = screen->display->workspaces; + tmp = data; + + while (tmp_list != NULL) + { + MetaWorkspace *workspace = tmp_list->data; + + if (workspace->screen == screen) + { + meta_workspace_get_work_area (workspace, &area); + tmp[0] = area.x; + tmp[1] = area.y; + tmp[2] = area.width; + tmp[3] = area.height; + + tmp += 4; + } + + tmp_list = tmp_list->next; + } + + meta_error_trap_push (screen->display); + XChangeProperty (screen->display->xdisplay, screen->xroot, + screen->display->atom_net_workarea, + XA_CARDINAL, 32, PropModeReplace, + (guchar*) data, num_workspaces*4); + g_free (data); + return meta_error_trap_pop (screen->display); +} + +static gboolean +set_work_area_idle_func (MetaScreen *screen) +{ + meta_topic (META_DEBUG_WORKAREA, + "Running work area idle function\n"); + + screen->work_area_idle = 0; + + set_work_area_hint (screen); + + return FALSE; +} + +void +meta_screen_queue_workarea_recalc (MetaScreen *screen) +{ + /* Recompute work area in an idle */ + if (screen->work_area_idle == 0) + { + meta_topic (META_DEBUG_WORKAREA, + "Adding work area hint idle function\n"); + screen->work_area_idle = + g_idle_add_full (META_PRIORITY_WORK_AREA_HINT, + (GSourceFunc) set_work_area_idle_func, + screen, + NULL); + } +} + void meta_screen_calc_workspace_layout (MetaScreen *screen, int num_workspaces, diff --git a/src/screen.h b/src/screen.h index cd374f2f2..e44f10349 100644 --- a/src/screen.h +++ b/src/screen.h @@ -111,6 +111,7 @@ const MetaXineramaScreenInfo* meta_screen_get_xinerama_for_window (MetaScreen *s void meta_screen_update_workspace_layout (MetaScreen *screen); void meta_screen_update_workspace_names (MetaScreen *screen); +void meta_screen_queue_workarea_recalc (MetaScreen *screen); Window meta_create_offscreen_window (Display *xdisplay, Window parent); @@ -121,7 +122,3 @@ void meta_screen_calc_workspace_layout (MetaScreen *screen, int *c); #endif - - - - diff --git a/src/workspace.c b/src/workspace.c index fdde992cb..8f194393b 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -29,7 +29,6 @@ void meta_workspace_queue_calc_showing (MetaWorkspace *workspace); static int set_number_of_spaces_hint (MetaScreen *screen); static int set_active_space_hint (MetaScreen *screen); -static int set_work_area_hint (MetaScreen *screen); MetaWorkspace* meta_workspace_new (MetaScreen *screen) @@ -343,63 +342,6 @@ set_active_space_hint (MetaScreen *screen) return meta_error_trap_pop (screen->display); } -static int -set_work_area_hint (MetaScreen *screen) -{ - int num_workspaces; - GList *tmp_list; - unsigned long *data, *tmp; - MetaRectangle area; - - num_workspaces = meta_screen_get_n_workspaces (screen); - data = g_new (unsigned long, num_workspaces * 4); - tmp_list = screen->display->workspaces; - tmp = data; - - while (tmp_list != NULL) - { - MetaWorkspace *workspace = tmp_list->data; - - if (workspace->screen == screen) - { - meta_workspace_get_work_area (workspace, &area); - tmp[0] = area.x; - tmp[1] = area.y; - tmp[2] = area.width; - tmp[3] = area.height; - - tmp += 4; - } - - tmp_list = tmp_list->next; - } - - meta_error_trap_push (screen->display); - XChangeProperty (screen->display->xdisplay, screen->xroot, - screen->display->atom_net_wm_workarea, - XA_CARDINAL, 32, PropModeReplace, - (guchar*) data, num_workspaces*4); - g_free (data); - return meta_error_trap_pop (screen->display); -} - -static gboolean -set_work_area_idle_func (void *data) -{ - MetaScreen *screen; - - meta_topic (META_DEBUG_WORKAREA, - "Running work area idle function\n"); - - screen = data; - - screen->work_area_idle = 0; - - set_work_area_hint (screen); - - return FALSE; -} - void meta_workspace_invalidate_work_area (MetaWorkspace *workspace) { @@ -434,17 +376,7 @@ meta_workspace_invalidate_work_area (MetaWorkspace *workspace) g_list_free (windows); - /* Recompute work area in an idle */ - if (workspace->screen->work_area_idle == 0) - { - meta_topic (META_DEBUG_WORKAREA, - "Adding work area hint idle function\n"); - workspace->screen->work_area_idle = - g_idle_add_full (META_PRIORITY_WORK_AREA_HINT, - set_work_area_idle_func, - workspace->screen, - NULL); - } + meta_screen_queue_workarea_recalc (workspace->screen); } void