From 53268f985fbc6410bd0cff3e1baf870fc07a3488 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 28 Apr 2002 15:47:21 +0000 Subject: [PATCH] Add support for setting the _NET_WM_WORKAREA hint. No code does it yet 2002-04-28 Anders Carlsson * src/display.c: (meta_display_open): * src/display.h: * src/screen.c: (set_supported_hint): * src/workspace.c: (set_number_of_spaces_hint), (set_workarea_hint): Add support for setting the _NET_WM_WORKAREA hint. No code does it yet though. --- ChangeLog | 10 ++++++++++ src/display.c | 6 ++++-- src/display.h | 1 + src/screen.c | 3 ++- src/workspace.c | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dd0f71a2..dbe6e78df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-04-28 Anders Carlsson + + * src/display.c: (meta_display_open): + * src/display.h: + * src/screen.c: (set_supported_hint): + * src/workspace.c: (set_number_of_spaces_hint), + (set_workarea_hint): + Add support for setting the _NET_WM_WORKAREA hint. No code + does it yet though. + 2002-04-28 Havoc Pennington * README: remove caveats about keybindings diff --git a/src/display.c b/src/display.c index bd6fc9bc7..88fc4b03a 100644 --- a/src/display.c +++ b/src/display.c @@ -204,7 +204,8 @@ meta_display_open (const char *name) "_NET_WM_STATE_FULLSCREEN", "_NET_WM_PING", "_NET_WM_PID", - "WM_CLIENT_MACHINE" + "WM_CLIENT_MACHINE", + "_NET_WM_WORKAREA" }; Atom atoms[G_N_ELEMENTS(atom_names)]; @@ -311,7 +312,8 @@ 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]; + /* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK, * created in screen_new */ diff --git a/src/display.h b/src/display.h index 9bf2945b2..26822cdc6 100644 --- a/src/display.h +++ b/src/display.h @@ -128,6 +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; /* This is the actual window from focus events, * not the one we last set diff --git a/src/screen.c b/src/screen.c index 9a5f2d566..a4a6dfeb5 100644 --- a/src/screen.c +++ b/src/screen.c @@ -82,7 +82,7 @@ set_wm_check_hint (MetaScreen *screen) static int set_supported_hint (MetaScreen *screen) { -#define N_SUPPORTED 29 +#define N_SUPPORTED 30 #define N_WIN_SUPPORTED 1 Atom atoms[N_SUPPORTED]; @@ -115,6 +115,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; XChangeProperty (screen->display->xdisplay, screen->xroot, screen->display->atom_net_supported, diff --git a/src/workspace.c b/src/workspace.c index a673deba8..5e45375dd 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -27,6 +27,7 @@ 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_workarea_hint (MetaScreen *screen); MetaWorkspace* meta_workspace_new (MetaScreen *screen) @@ -313,6 +314,43 @@ set_number_of_spaces_hint (MetaScreen *screen) return meta_error_trap_pop (screen->display); } +static int +set_workarea_hint (MetaScreen *screen) +{ + int num_workspaces; + GList *tmp_list; + unsigned long *data, *tmp; + MetaRectangle area; + + num_workspaces = g_list_length (screen->display->workspaces); + data = g_new (unsigned long, num_workspaces); + tmp_list = screen->display->workspaces; + tmp = data; + + while (tmp_list != NULL) + { + MetaWorkspace *workspace = tmp_list->data; + + meta_workspace_get_work_area (workspace, &area); + tmp[0] = area.x; + tmp[1] = area.y; + tmp[2] = area.width; + tmp[3] = area.height; + + tmp += sizeof (unsigned long) * 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 int set_active_space_hint (MetaScreen *screen) {