workspaces are all per-screen now, fix accordingly

2002-10-16  Havoc Pennington  <hp@redhat.com>

	* src/workspace.c: workspaces are all per-screen now, fix
	accordingly

	* src/core.c: fix multihead workspace stuff

	* src/keybindings.c: multihead-rama

	* src/screen.c (meta_screen_show_desktop): new functions to
	replace display equivalents

	* src/display.c (meta_display_get_workspace_by_screen_index): get
	rid of this
	(meta_display_get_workspace_by_index): get rid of this
	(event_callback): handle _NET_SHOWING_DESKTOP message per-screen

	* src/screen.c (meta_screen_get_workspace_by_index): new function

	* src/screen.h (struct _MetaScreen): move workspace list, and
	showing_desktop flag, to be per-screen

	* src/window.c (window_query_root_pointer): return whether pointer
	is on window's screen
	(meta_window_handle_mouse_grab_op_event): don't use coordinates
	from other screens when updating a window operation on the current
	screen. I can't believe no one has reported this...
This commit is contained in:
Havoc Pennington 2002-10-16 20:12:24 +00:00 committed by Havoc Pennington
parent 17ac646f70
commit 337812d51d
14 changed files with 311 additions and 330 deletions

View File

@ -1,3 +1,31 @@
2002-10-16 Havoc Pennington <hp@redhat.com>
* src/workspace.c: workspaces are all per-screen now, fix
accordingly
* src/core.c: fix multihead workspace stuff
* src/keybindings.c: multihead-rama
* src/screen.c (meta_screen_show_desktop): new functions to
replace display equivalents
* src/display.c (meta_display_get_workspace_by_screen_index): get
rid of this
(meta_display_get_workspace_by_index): get rid of this
(event_callback): handle _NET_SHOWING_DESKTOP message per-screen
* src/screen.c (meta_screen_get_workspace_by_index): new function
* src/screen.h (struct _MetaScreen): move workspace list, and
showing_desktop flag, to be per-screen
* src/window.c (window_query_root_pointer): return whether pointer
is on window's screen
(meta_window_handle_mouse_grab_op_event): don't use coordinates
from other screens when updating a window operation on the current
screen. I can't believe no one has reported this...
2002-10-16 Havoc Pennington <hp@pobox.com> 2002-10-16 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_client_message): update window layer * src/window.c (meta_window_client_message): update window layer

View File

@ -434,9 +434,8 @@ meta_core_change_workspace (Display *xdisplay,
meta_bug ("No such frame window 0x%lx!\n", frame_xwindow); meta_bug ("No such frame window 0x%lx!\n", frame_xwindow);
meta_window_change_workspace (window, meta_window_change_workspace (window,
meta_display_get_workspace_by_screen_index (display, meta_screen_get_workspace_by_index (window->screen,
window->screen, new_workspace));
new_workspace));
} }
int int
@ -456,7 +455,7 @@ meta_core_get_active_workspace (Screen *xscreen)
screen = meta_screen_for_x_screen (xscreen); screen = meta_screen_for_x_screen (xscreen);
return meta_workspace_screen_index (screen->active_workspace); return meta_workspace_index (screen->active_workspace);
} }
int int
@ -624,13 +623,17 @@ meta_core_get_menu_accelerator (MetaMenuOp menu_op,
char * char *
meta_core_get_workspace_name_with_index (Display *xdisplay, meta_core_get_workspace_name_with_index (Display *xdisplay,
int index) Window xroot,
int index)
{ {
MetaDisplay *display; MetaDisplay *display;
MetaScreen *screen;
MetaWorkspace *workspace; MetaWorkspace *workspace;
display = meta_display_for_x_display (xdisplay); display = meta_display_for_x_display (xdisplay);
workspace = meta_display_get_workspace_by_index (display, index); screen = meta_display_screen_for_root (display, xroot);
g_assert (screen != NULL);
workspace = meta_screen_get_workspace_by_index (screen, index);
return (workspace != NULL) ? workspace->name : NULL; return (workspace != NULL) ? workspace->name : NULL;
} }

View File

@ -101,7 +101,8 @@ int meta_core_get_active_workspace (Screen *xscreen);
int meta_core_get_frame_workspace (Display *xdisplay, int meta_core_get_frame_workspace (Display *xdisplay,
Window frame_xwindow); Window frame_xwindow);
char* meta_core_get_workspace_name_with_index (Display *xdisplay, char* meta_core_get_workspace_name_with_index (Display *xdisplay,
int index); Window xroot,
int index);
void meta_core_get_frame_extents (Display *xdisplay, void meta_core_get_frame_extents (Display *xdisplay,
Window frame_xwindow, Window frame_xwindow,

View File

@ -261,7 +261,6 @@ meta_display_open (const char *name)
display->error_traps = 0; display->error_traps = 0;
display->error_trap_handler = NULL; display->error_trap_handler = NULL;
display->server_grab_count = 0; display->server_grab_count = 0;
display->workspaces = NULL;
display->pending_pings = NULL; display->pending_pings = NULL;
display->autoraise_timeout_id = 0; display->autoraise_timeout_id = 0;
@ -269,8 +268,6 @@ meta_display_open (const char *name)
display->expected_focus_window = NULL; display->expected_focus_window = NULL;
display->mru_list = NULL; display->mru_list = NULL;
display->showing_desktop = FALSE;
/* FIXME copy the checks from GDK probably */ /* FIXME copy the checks from GDK probably */
display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL; display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL;
@ -1539,9 +1536,8 @@ event_callback (XEvent *event,
space); space);
workspace = workspace =
meta_display_get_workspace_by_screen_index (display, meta_screen_get_workspace_by_index (screen,
screen, space);
space);
if (workspace) if (workspace)
meta_workspace_activate (workspace); meta_workspace_activate (workspace);
@ -1569,9 +1565,9 @@ event_callback (XEvent *event,
meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide"); meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide");
if (showing_desktop) if (showing_desktop)
meta_display_show_desktop (display); meta_screen_show_desktop (screen);
else else
meta_display_unshow_desktop (display); meta_screen_unshow_desktop (screen);
} }
else if (event->xclient.message_type == else if (event->xclient.message_type ==
display->atom_metacity_restart_message) display->atom_metacity_restart_message)
@ -2145,56 +2141,6 @@ meta_display_unregister_x_window (MetaDisplay *display,
remove_pending_pings_for_window (display, xwindow); remove_pending_pings_for_window (display, xwindow);
} }
MetaWorkspace*
meta_display_get_workspace_by_index (MetaDisplay *display,
int idx)
{
GList *tmp;
/* should be robust, index is maybe from an app */
if (idx < 0)
return NULL;
tmp = g_list_nth (display->workspaces, idx);
if (tmp == NULL)
return NULL;
else
return tmp->data;
}
MetaWorkspace*
meta_display_get_workspace_by_screen_index (MetaDisplay *display,
MetaScreen *screen,
int idx)
{
GList *tmp;
int i;
/* should be robust, idx is maybe from an app */
if (idx < 0)
return NULL;
i = 0;
tmp = display->workspaces;
while (tmp != NULL)
{
MetaWorkspace *w = tmp->data;
if (w->screen == screen)
{
if (i == idx)
return w;
else
++i;
}
tmp = tmp->next;
}
return NULL;
}
Cursor Cursor
meta_display_create_x_cursor (MetaDisplay *display, meta_display_create_x_cursor (MetaDisplay *display,
MetaCursor cursor) MetaCursor cursor)
@ -2712,31 +2658,6 @@ meta_display_increment_event_serial (MetaDisplay *display)
display->atom_motif_wm_hints); display->atom_motif_wm_hints);
} }
static void
meta_display_update_showing_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_showing_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)
{ {
@ -2766,62 +2687,6 @@ meta_display_update_active_window_hint (MetaDisplay *display)
} }
} }
static void
queue_windows_showing (MetaDisplay *display)
{
GSList *windows;
GSList *tmp;
windows = meta_display_list_windows (display);
tmp = windows;
while (tmp != NULL)
{
meta_window_queue_calc_showing (tmp->data);
tmp = tmp->next;
}
g_slist_free (windows);
}
void
meta_display_show_desktop (MetaDisplay *display)
{
if (display->showing_desktop)
return;
display->showing_desktop = TRUE;
queue_windows_showing (display);
meta_display_update_showing_desktop_hint (display);
}
void
meta_display_unshow_desktop (MetaDisplay *display)
{
GSList *tmp;
if (!display->showing_desktop)
return;
display->showing_desktop = FALSE;
queue_windows_showing (display);
meta_display_update_showing_desktop_hint (display);
tmp = display->screens;
while (tmp != NULL)
{
MetaScreen *screen = tmp->data;
meta_screen_focus_top_window (screen, NULL);
tmp = tmp->next;
}
}
void void
meta_display_queue_retheme_all_windows (MetaDisplay *display) meta_display_queue_retheme_all_windows (MetaDisplay *display)
{ {

View File

@ -164,9 +164,6 @@ struct _MetaDisplay
*/ */
GList *mru_list; GList *mru_list;
GList *workspaces;
guint showing_desktop : 1;
guint static_gravity_works : 1; guint static_gravity_works : 1;
/*< private-ish >*/ /*< private-ish >*/
@ -288,12 +285,6 @@ GSList* meta_display_list_windows (MetaDisplay *display);
MetaDisplay* meta_display_for_x_display (Display *xdisplay); MetaDisplay* meta_display_for_x_display (Display *xdisplay);
GSList* meta_displays_list (void); GSList* meta_displays_list (void);
MetaWorkspace* meta_display_get_workspace_by_index (MetaDisplay *display,
int index);
MetaWorkspace* meta_display_get_workspace_by_screen_index (MetaDisplay *display,
MetaScreen *screen,
int index);
Cursor meta_display_create_x_cursor (MetaDisplay *display, Cursor meta_display_create_x_cursor (MetaDisplay *display,
MetaCursor cursor); MetaCursor cursor);
@ -332,10 +323,6 @@ void meta_display_increment_event_serial (MetaDisplay *display);
void meta_display_update_active_window_hint (MetaDisplay *display); void meta_display_update_active_window_hint (MetaDisplay *display);
/* Show/hide the desktop (temporarily hide all windows) */
void meta_display_show_desktop (MetaDisplay *display);
void meta_display_unshow_desktop (MetaDisplay *display);
guint32 meta_display_get_current_time (MetaDisplay *display); guint32 meta_display_get_current_time (MetaDisplay *display);
/* utility goo */ /* utility goo */

View File

@ -34,116 +34,143 @@
static gboolean all_bindings_disabled = FALSE; static gboolean all_bindings_disabled = FALSE;
typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display, typedef void (* MetaKeyHandlerFunc) (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_activate_workspace (MetaDisplay *display, static void handle_activate_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_activate_menu (MetaDisplay *display, static void handle_activate_menu (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_tab_forward (MetaDisplay *display, static void handle_tab_forward (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_cycle_forward (MetaDisplay *display, static void handle_cycle_forward (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_toggle_fullscreen (MetaDisplay *display, static void handle_toggle_fullscreen (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_toggle_desktop (MetaDisplay *display, static void handle_toggle_desktop (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_toggle_maximize (MetaDisplay *display, static void handle_toggle_maximize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_maximize (MetaDisplay *display, static void handle_maximize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_unmaximize (MetaDisplay *display, static void handle_unmaximize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_toggle_shade (MetaDisplay *display, static void handle_toggle_shade (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_close_window (MetaDisplay *display, static void handle_close_window (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_minimize_window (MetaDisplay *display, static void handle_minimize_window (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_begin_move (MetaDisplay *display, static void handle_begin_move (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_begin_resize (MetaDisplay *display, static void handle_begin_resize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_toggle_sticky (MetaDisplay *display, static void handle_toggle_sticky (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_move_to_workspace (MetaDisplay *display, static void handle_move_to_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_workspace_switch (MetaDisplay *display, static void handle_workspace_switch (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_raise_or_lower (MetaDisplay *display, static void handle_raise_or_lower (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_raise (MetaDisplay *display, static void handle_raise (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_lower (MetaDisplay *display, static void handle_lower (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static void handle_run_command (MetaDisplay *display, static void handle_run_command (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
/* debug */ /* debug */
static void handle_spew_mark (MetaDisplay *display, static void handle_spew_mark (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding); MetaKeyBinding *binding);
static gboolean process_keyboard_move_grab (MetaDisplay *display, static gboolean process_keyboard_move_grab (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
KeySym keysym); KeySym keysym);
static gboolean process_keyboard_resize_grab (MetaDisplay *display, static gboolean process_keyboard_resize_grab (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
KeySym keysym); KeySym keysym);
static gboolean process_tab_grab (MetaDisplay *display, static gboolean process_tab_grab (MetaDisplay *display,
MetaScreen *screen,
XEvent *event, XEvent *event,
KeySym keysym); KeySym keysym);
static gboolean process_workspace_switch_grab (MetaDisplay *display, static gboolean process_workspace_switch_grab (MetaDisplay *display,
MetaScreen *screen,
XEvent *event, XEvent *event,
KeySym keysym); KeySym keysym);
@ -1198,6 +1225,7 @@ process_event (MetaKeyBinding *bindings,
int n_bindings, int n_bindings,
const MetaKeyHandler *handlers, const MetaKeyHandler *handlers,
MetaDisplay *display, MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
KeySym keysym) KeySym keysym)
@ -1233,7 +1261,7 @@ process_event (MetaKeyBinding *bindings,
"Running handler for %s\n", "Running handler for %s\n",
bindings[i].name); bindings[i].name);
(* handler->func) (display, window, event, (* handler->func) (display, screen, window, event,
&bindings[i]); &bindings[i]);
return; return;
} }
@ -1262,8 +1290,13 @@ meta_display_process_key_event (MetaDisplay *display,
if (all_bindings_disabled) if (all_bindings_disabled)
return; return;
screen = meta_display_screen_for_xwindow (display, /* if key event was on root window, we have a shortcut */
event->xany.window); screen = meta_display_screen_for_root (display, event->xkey.window);
/* else round-trip to server */
if (screen == NULL)
screen = meta_display_screen_for_xwindow (display,
event->xany.window);
if (screen == NULL) if (screen == NULL)
return; /* event window is destroyed */ return; /* event window is destroyed */
@ -1292,13 +1325,13 @@ meta_display_process_key_event (MetaDisplay *display,
process_event (display->screen_bindings, process_event (display->screen_bindings,
display->n_screen_bindings, display->n_screen_bindings,
screen_handlers, screen_handlers,
display, NULL, event, keysym); display, screen, NULL, event, keysym);
if (window) if (window)
process_event (display->window_bindings, process_event (display->window_bindings,
display->n_window_bindings, display->n_window_bindings,
window_handlers, window_handlers,
display, window, event, keysym); display, screen, window, event, keysym);
return; return;
} }
@ -1322,7 +1355,8 @@ meta_display_process_key_event (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard move\n"); "Processing event for keyboard move\n");
g_assert (window != NULL); g_assert (window != NULL);
handled = process_keyboard_move_grab (display, window, event, keysym); handled = process_keyboard_move_grab (display, screen,
window, event, keysym);
break; break;
case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN: case META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN:
@ -1337,7 +1371,8 @@ meta_display_process_key_event (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard resize\n"); "Processing event for keyboard resize\n");
g_assert (window != NULL); g_assert (window != NULL);
handled = process_keyboard_resize_grab (display, window, event, keysym); handled = process_keyboard_resize_grab (display, screen,
window, event, keysym);
break; break;
case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: case META_GRAB_OP_KEYBOARD_TABBING_NORMAL:
@ -1346,13 +1381,13 @@ meta_display_process_key_event (MetaDisplay *display,
case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK:
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard tabbing/cycling\n"); "Processing event for keyboard tabbing/cycling\n");
handled = process_tab_grab (display, event, keysym); handled = process_tab_grab (display, screen, event, keysym);
break; break;
case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING: case META_GRAB_OP_KEYBOARD_WORKSPACE_SWITCHING:
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard workspace switching\n"); "Processing event for keyboard workspace switching\n");
handled = process_workspace_switch_grab (display, event, keysym); handled = process_workspace_switch_grab (display, screen, event, keysym);
break; break;
default: default:
@ -1372,6 +1407,7 @@ meta_display_process_key_event (MetaDisplay *display,
static gboolean static gboolean
process_keyboard_move_grab (MetaDisplay *display, process_keyboard_move_grab (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
KeySym keysym) KeySym keysym)
@ -1478,6 +1514,7 @@ process_keyboard_move_grab (MetaDisplay *display,
static gboolean static gboolean
process_keyboard_resize_grab (MetaDisplay *display, process_keyboard_resize_grab (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
KeySym keysym) KeySym keysym)
@ -1860,14 +1897,15 @@ process_keyboard_resize_grab (MetaDisplay *display,
static gboolean static gboolean
process_tab_grab (MetaDisplay *display, process_tab_grab (MetaDisplay *display,
MetaScreen *screen,
XEvent *event, XEvent *event,
KeySym keysym) KeySym keysym)
{ {
MetaScreen *screen;
MetaKeyBindingAction action; MetaKeyBindingAction action;
gboolean popup_not_showing; gboolean popup_not_showing;
screen = display->grab_screen; if (screen != display->grab_screen)
return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE); g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
@ -2010,6 +2048,7 @@ switch_to_workspace (MetaDisplay *display,
static void static void
handle_activate_workspace (MetaDisplay *display, handle_activate_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window, MetaWindow *event_window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2022,20 +2061,12 @@ handle_activate_workspace (MetaDisplay *display,
workspace = NULL; workspace = NULL;
if (which < 0) if (which < 0)
{ {
MetaScreen *screen;
screen = meta_display_screen_for_root (display,
event->xkey.root);
if (screen == NULL)
return;
workspace = meta_workspace_get_neighbor (screen->active_workspace, workspace = meta_workspace_get_neighbor (screen->active_workspace,
which); which);
} }
else else
{ {
workspace = meta_display_get_workspace_by_index (display, which); workspace = meta_screen_get_workspace_by_index (screen, which);
} }
if (workspace) if (workspace)
@ -2091,6 +2122,7 @@ error_on_command (int command_index,
static void static void
handle_run_command (MetaDisplay *display, handle_run_command (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2130,13 +2162,14 @@ handle_run_command (MetaDisplay *display,
static gboolean static gboolean
process_workspace_switch_grab (MetaDisplay *display, process_workspace_switch_grab (MetaDisplay *display,
MetaScreen *screen,
XEvent *event, XEvent *event,
KeySym keysym) KeySym keysym)
{ {
MetaScreen *screen;
MetaWorkspace *workspace; MetaWorkspace *workspace;
screen = display->grab_screen; if (screen != display->grab_screen)
return FALSE;
g_return_val_if_fail (screen->tab_popup != NULL, FALSE); g_return_val_if_fail (screen->tab_popup != NULL, FALSE);
@ -2241,18 +2274,20 @@ process_workspace_switch_grab (MetaDisplay *display,
static void static void
handle_toggle_desktop (MetaDisplay *display, handle_toggle_desktop (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
if (display->showing_desktop) if (screen->showing_desktop)
meta_display_unshow_desktop (display); meta_screen_unshow_desktop (screen);
else else
meta_display_show_desktop (display); meta_screen_show_desktop (screen);
} }
static void static void
handle_activate_menu (MetaDisplay *display, handle_activate_menu (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window, MetaWindow *event_window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2305,12 +2340,12 @@ cycle_op_from_tab_type (MetaTabList type)
static void static void
do_choose_window (MetaDisplay *display, do_choose_window (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window, MetaWindow *event_window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding, MetaKeyBinding *binding,
gboolean show_popup) gboolean show_popup)
{ {
MetaScreen *screen;
MetaTabList type; MetaTabList type;
gboolean backward; gboolean backward;
MetaWindow *initial_selection; MetaWindow *initial_selection;
@ -2320,17 +2355,6 @@ do_choose_window (MetaDisplay *display,
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Tab list = %d show_popup = %d\n", type, show_popup); "Tab list = %d show_popup = %d\n", type, show_popup);
screen = meta_display_screen_for_root (display,
event->xkey.root);
if (screen == NULL)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"No screen for root 0x%lx, not doing choose_window\n",
event->xkey.root);
return;
}
/* backward if shift is down, this isn't configurable */ /* backward if shift is down, this isn't configurable */
backward = (event->xkey.state & ShiftMask) != 0; backward = (event->xkey.state & ShiftMask) != 0;
@ -2377,24 +2401,29 @@ do_choose_window (MetaDisplay *display,
static void static void
handle_tab_forward (MetaDisplay *display, handle_tab_forward (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window, MetaWindow *event_window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
do_choose_window (display, event_window, event, binding, TRUE); do_choose_window (display, screen,
event_window, event, binding, TRUE);
} }
static void static void
handle_cycle_forward (MetaDisplay *display, handle_cycle_forward (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window, MetaWindow *event_window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
do_choose_window (display, event_window, event, binding, FALSE); do_choose_window (display, screen,
event_window, event, binding, FALSE);
} }
static void static void
handle_toggle_fullscreen (MetaDisplay *display, handle_toggle_fullscreen (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2410,6 +2439,7 @@ handle_toggle_fullscreen (MetaDisplay *display,
static void static void
handle_toggle_maximize (MetaDisplay *display, handle_toggle_maximize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2425,6 +2455,7 @@ handle_toggle_maximize (MetaDisplay *display,
static void static void
handle_maximize (MetaDisplay *display, handle_maximize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2438,6 +2469,7 @@ handle_maximize (MetaDisplay *display,
static void static void
handle_unmaximize (MetaDisplay *display, handle_unmaximize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2451,6 +2483,7 @@ handle_unmaximize (MetaDisplay *display,
static void static void
handle_toggle_shade (MetaDisplay *display, handle_toggle_shade (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2466,6 +2499,7 @@ handle_toggle_shade (MetaDisplay *display,
static void static void
handle_close_window (MetaDisplay *display, handle_close_window (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2477,6 +2511,7 @@ handle_close_window (MetaDisplay *display,
static void static void
handle_minimize_window (MetaDisplay *display, handle_minimize_window (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2488,6 +2523,7 @@ handle_minimize_window (MetaDisplay *display,
static void static void
handle_begin_move (MetaDisplay *display, handle_begin_move (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2502,6 +2538,7 @@ handle_begin_move (MetaDisplay *display,
static void static void
handle_begin_resize (MetaDisplay *display, handle_begin_resize (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2516,6 +2553,7 @@ handle_begin_resize (MetaDisplay *display,
static void static void
handle_toggle_sticky (MetaDisplay *display, handle_toggle_sticky (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2531,6 +2569,7 @@ handle_toggle_sticky (MetaDisplay *display,
static void static void
handle_move_to_workspace (MetaDisplay *display, handle_move_to_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2546,20 +2585,12 @@ handle_move_to_workspace (MetaDisplay *display,
workspace = NULL; workspace = NULL;
if (which < 0) if (which < 0)
{ {
MetaScreen *screen;
screen = meta_display_screen_for_root (display,
event->xkey.root);
if (screen == NULL)
return;
workspace = meta_workspace_get_neighbor (screen->active_workspace, workspace = meta_workspace_get_neighbor (screen->active_workspace,
which); which);
} }
else else
{ {
workspace = meta_display_get_workspace_by_index (display, which); workspace = meta_screen_get_workspace_by_index (screen, which);
} }
if (workspace) if (workspace)
@ -2576,21 +2607,13 @@ handle_move_to_workspace (MetaDisplay *display,
static void static void
handle_raise_or_lower (MetaDisplay *display, handle_raise_or_lower (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
/* Get window at pointer */ /* Get window at pointer */
MetaScreen *screen;
/* FIXME I'm really not sure why we get the screen here
* instead of using window->screen
*/
screen = meta_display_screen_for_root (display, event->xbutton.root);
if (screen == NULL)
return;
if (window) if (window)
{ {
MetaWindow *above = NULL; MetaWindow *above = NULL;
@ -2630,6 +2653,7 @@ handle_raise_or_lower (MetaDisplay *display,
static void static void
handle_raise (MetaDisplay *display, handle_raise (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2642,6 +2666,7 @@ handle_raise (MetaDisplay *display,
static void static void
handle_lower (MetaDisplay *display, handle_lower (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
@ -2654,22 +2679,17 @@ handle_lower (MetaDisplay *display,
static void static void
handle_workspace_switch (MetaDisplay *display, handle_workspace_switch (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
int motion; int motion;
MetaScreen *screen;
motion = GPOINTER_TO_INT (binding->handler->data); motion = GPOINTER_TO_INT (binding->handler->data);
g_assert (motion < 0); g_assert (motion < 0);
screen = meta_display_screen_for_root (display,
event->xkey.root);
if (screen == NULL)
return;
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
"Starting tab between workspaces, showing popup\n"); "Starting tab between workspaces, showing popup\n");
@ -2703,6 +2723,7 @@ handle_workspace_switch (MetaDisplay *display,
static void static void
handle_spew_mark (MetaDisplay *display, handle_spew_mark (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window, MetaWindow *window,
XEvent *event, XEvent *event,
MetaKeyBinding *binding) MetaKeyBinding *binding)

View File

@ -133,12 +133,13 @@ activate_cb (GtkWidget *menuitem, gpointer data)
*/ */
static char * static char *
get_workspace_name_with_accel (Display *display, get_workspace_name_with_accel (Display *display,
int index) Window xroot,
int index)
{ {
char *name; char *name;
unsigned int number; unsigned int number;
name = meta_core_get_workspace_name_with_index (display, index); name = meta_core_get_workspace_name_with_index (display, xroot, index);
/* /*
* If the name is of the form "Workspace x" where x is an unsigned * If the name is of the form "Workspace x" where x is an unsigned
@ -312,8 +313,21 @@ meta_window_menu_new (MetaFrames *frames,
{ {
GtkWidget *mi; GtkWidget *mi;
Display *display; Display *display;
Window xroot;
display = gdk_x11_drawable_get_xdisplay(GTK_WIDGET(frames)->window); display = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (frames)->window);
#ifdef HAVE_GTK_MULTIHEAD
{
GdkScreen *screen;
screen = gdk_drawable_get_screen (GTK_WIDGET (frames)->window);
xroot = GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen));
}
#else
{
xroot = gdk_x11_get_default_root_xwindow ();
}
#endif
i = 0; i = 0;
while (i < n_workspaces) while (i < n_workspaces)
@ -327,7 +341,7 @@ meta_window_menu_new (MetaFrames *frames,
i + 1, i + 1,
&key, &mods); &key, &mods);
name = get_workspace_name_with_accel (display, i); name = get_workspace_name_with_accel (display, xroot, i);
if (ops & META_MENU_OP_UNSTICK) if (ops & META_MENU_OP_UNSTICK)
label = g_strdup_printf (_("Only on %s"), name); label = g_strdup_printf (_("Only on %s"), name);
else else

View File

@ -56,7 +56,9 @@ if test -z "$ONLY_WM"; then
echo "Launching clients" echo "Launching clients"
if test -n "$TEST_CLIENT"; then if test -n "$TEST_CLIENT"; then
DISPLAY=$CLIENT_DISPLAY $TEST_CLIENT & for I in `seq 0 $SCREENS`; do
DISPLAY=$CLIENT_DISPLAY.$I $TEST_CLIENT &
done
fi fi
if test $CLIENTS != 0; then if test $CLIENTS != 0; then
@ -79,7 +81,9 @@ if test -z "$ONLY_WM"; then
usleep 50000 usleep 50000
DISPLAY=$CLIENT_DISPLAY xsetroot -solid royalblue3 for I in `seq 0 $SCREENS`; do
DISPLAY=$CLIENT_DISPLAY.$I xsetroot -solid royalblue3
done
fi fi
if test -z "$ONLY_SETUP"; then if test -z "$ONLY_SETUP"; then

View File

@ -523,11 +523,14 @@ meta_screen_new (MetaDisplay *display,
screen->work_area_idle = 0; screen->work_area_idle = 0;
screen->active_workspace = NULL; screen->active_workspace = NULL;
screen->workspaces = NULL;
screen->rows_of_workspaces = 1; screen->rows_of_workspaces = 1;
screen->columns_of_workspaces = -1; screen->columns_of_workspaces = -1;
screen->vertical_workspaces = FALSE; screen->vertical_workspaces = FALSE;
screen->starting_corner = META_SCREEN_TOPLEFT; screen->starting_corner = META_SCREEN_TOPLEFT;
screen->showing_desktop = FALSE;
screen->xinerama_infos = NULL; screen->xinerama_infos = NULL;
screen->n_xinerama_infos = 0; screen->n_xinerama_infos = 0;
screen->last_xinerama_index = 0; screen->last_xinerama_index = 0;
@ -810,23 +813,35 @@ meta_screen_queue_window_resizes (MetaScreen *screen)
int int
meta_screen_get_n_workspaces (MetaScreen *screen) meta_screen_get_n_workspaces (MetaScreen *screen)
{
return g_list_length (screen->workspaces);
}
MetaWorkspace*
meta_screen_get_workspace_by_index (MetaScreen *screen,
int idx)
{ {
GList *tmp; GList *tmp;
int i; int i;
/* should be robust, idx is maybe from an app */
if (idx < 0)
return NULL;
i = 0; i = 0;
tmp = screen->display->workspaces; tmp = screen->workspaces;
while (tmp != NULL) while (tmp != NULL)
{ {
MetaWorkspace *w = tmp->data; MetaWorkspace *w = tmp->data;
if (w->screen == screen) if (i == idx)
++i; return w;
++i;
tmp = tmp->next; tmp = tmp->next;
} }
return i; return NULL;
} }
static int static int
@ -867,21 +882,17 @@ update_num_workspaces (MetaScreen *screen)
last_remaining = NULL; last_remaining = NULL;
extras = NULL; extras = NULL;
i = 0; i = 0;
tmp = screen->display->workspaces; tmp = screen->workspaces;
while (tmp != NULL) while (tmp != NULL)
{ {
MetaWorkspace *w = tmp->data; MetaWorkspace *w = tmp->data;
if (w->screen == screen) if (i > new_num)
{ extras = g_list_prepend (extras, w);
++i; else
last_remaining = w;
if (i > new_num)
extras = g_list_prepend (extras, w);
else
last_remaining = w;
}
++i;
tmp = tmp->next; tmp = tmp->next;
} }
@ -1078,7 +1089,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
if (k >= len) if (k >= len)
break; break;
workspace = meta_display_get_workspace_by_index (screen->display, k); workspace = meta_screen_get_workspace_by_index (screen, k);
g_assert (workspace); g_assert (workspace);
entries[iter].key = (MetaTabEntryKey) workspace; entries[iter].key = (MetaTabEntryKey) workspace;
@ -1096,7 +1107,7 @@ meta_screen_ensure_workspace_popup (MetaScreen *screen)
{ {
MetaWorkspace *workspace; MetaWorkspace *workspace;
workspace = meta_display_get_workspace_by_index (screen->display, i); workspace = meta_screen_get_workspace_by_index (screen, i);
g_assert (workspace); g_assert (workspace);
@ -1362,17 +1373,14 @@ meta_screen_update_workspace_names (MetaScreen *screen)
} }
i = 0; i = 0;
tmp = screen->display->workspaces; tmp = screen->workspaces;
while (tmp != NULL && i < n_names) while (tmp != NULL && i < n_names)
{ {
MetaWorkspace *w = tmp->data; MetaWorkspace *w = tmp->data;
if (w->screen == screen) meta_workspace_set_name (w, names[i]);
{
meta_workspace_set_name (w, names[i]);
++i; ++i;
}
tmp = tmp->next; tmp = tmp->next;
} }
@ -1413,7 +1421,7 @@ set_work_area_hint (MetaScreen *screen)
num_workspaces = meta_screen_get_n_workspaces (screen); num_workspaces = meta_screen_get_n_workspaces (screen);
data = g_new (unsigned long, num_workspaces * 4); data = g_new (unsigned long, num_workspaces * 4);
tmp_list = screen->display->workspaces; tmp_list = screen->workspaces;
tmp = data; tmp = data;
while (tmp_list != NULL) while (tmp_list != NULL)
@ -1543,3 +1551,68 @@ meta_screen_resize (MetaScreen *screen,
/* Queue a resize on all the windows */ /* Queue a resize on all the windows */
meta_screen_foreach_window (screen, meta_screen_resize_func, 0); meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
} }
static void
update_showing_desktop_hint (MetaScreen *screen)
{
unsigned long data[1];
data[0] = screen->showing_desktop ? 1 : 0;
meta_error_trap_push (screen->display);
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_net_showing_desktop,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
}
static void
queue_windows_showing (MetaScreen *screen)
{
GSList *windows;
GSList *tmp;
windows = meta_display_list_windows (screen->display);
tmp = windows;
while (tmp != NULL)
{
MetaWindow *w = tmp->data;
if (w->screen == screen)
meta_window_queue_calc_showing (w);
tmp = tmp->next;
}
g_slist_free (windows);
}
void
meta_screen_show_desktop (MetaScreen *screen)
{
if (screen->showing_desktop)
return;
screen->showing_desktop = TRUE;
queue_windows_showing (screen);
update_showing_desktop_hint (screen);
}
void
meta_screen_unshow_desktop (MetaScreen *screen)
{
if (!screen->showing_desktop)
return;
screen->showing_desktop = FALSE;
queue_windows_showing (screen);
update_showing_desktop_hint (screen);
meta_screen_focus_top_window (screen, NULL);
}

View File

@ -64,6 +64,8 @@ struct _MetaScreen
MetaWorkspace *active_workspace; MetaWorkspace *active_workspace;
GList *workspaces;
MetaStack *stack; MetaStack *stack;
MetaCursor current_cursor; MetaCursor current_cursor;
@ -87,6 +89,7 @@ struct _MetaScreen
guint keys_grabbed : 1; guint keys_grabbed : 1;
guint all_keys_grabbed : 1; guint all_keys_grabbed : 1;
guint showing_desktop : 1;
int closing; int closing;
}; };
@ -104,6 +107,9 @@ void meta_screen_queue_window_resizes (MetaScreen *scre
int meta_screen_get_n_workspaces (MetaScreen *screen); int meta_screen_get_n_workspaces (MetaScreen *screen);
MetaWorkspace* meta_screen_get_workspace_by_index (MetaScreen *screen,
int index);
void meta_screen_set_cursor (MetaScreen *screen, void meta_screen_set_cursor (MetaScreen *screen,
MetaCursor cursor); MetaCursor cursor);
@ -136,4 +142,9 @@ void meta_screen_resize (MetaScreen *screen,
int height); int height);
/* Show/hide the desktop (temporarily hide all windows) */
void meta_screen_show_desktop (MetaScreen *screen);
void meta_screen_unshow_desktop (MetaScreen *screen);
#endif #endif

View File

@ -1008,7 +1008,7 @@ save_state (void)
while (w != NULL) while (w != NULL)
{ {
int n; int n;
n = meta_workspace_screen_index (w->data); n = meta_workspace_index (w->data);
fprintf (outfile, fprintf (outfile,
" <workspace index=\"%d\"/>\n", n); " <workspace index=\"%d\"/>\n", n);

View File

@ -522,9 +522,8 @@ meta_window_new (MetaDisplay *display, Window xwindow,
window->desc, window->initial_workspace); window->desc, window->initial_workspace);
space = space =
meta_display_get_workspace_by_screen_index (window->display, meta_screen_get_workspace_by_index (window->screen,
window->screen, window->initial_workspace);
window->initial_workspace);
if (space) if (space)
meta_workspace_add_window (space, window); meta_workspace_add_window (space, window);
@ -640,10 +639,10 @@ meta_window_new (MetaDisplay *display, Window xwindow,
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);
/* disable show desktop mode unless we're a desktop component */ /* disable show desktop mode unless we're a desktop component */
if (window->display->showing_desktop && if (window->screen->showing_desktop &&
window->type != META_WINDOW_DESKTOP && window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK) window->type != META_WINDOW_DOCK)
meta_display_unshow_desktop (window->display); meta_screen_unshow_desktop (window->screen);
meta_window_queue_calc_showing (window); meta_window_queue_calc_showing (window);
@ -725,9 +724,8 @@ meta_window_apply_session_info (MetaWindow *window,
MetaWorkspace *space; MetaWorkspace *space;
space = space =
meta_display_get_workspace_by_screen_index (window->display, meta_screen_get_workspace_by_index (window->screen,
window->screen, GPOINTER_TO_INT (tmp->data));
GPOINTER_TO_INT (tmp->data));
if (space) if (space)
spaces = g_slist_prepend (spaces, space); spaces = g_slist_prepend (spaces, space);
@ -757,7 +755,7 @@ meta_window_apply_session_info (MetaWindow *window,
meta_topic (META_DEBUG_SM, meta_topic (META_DEBUG_SM,
"Restoring saved window %s to workspace %d\n", "Restoring saved window %s to workspace %d\n",
window->desc, window->desc,
meta_workspace_screen_index (space)); meta_workspace_index (space));
tmp = tmp->next; tmp = tmp->next;
} }
@ -1110,7 +1108,7 @@ meta_window_calc_showing (MetaWindow *window)
/* 3. See if we're in "show desktop" mode */ /* 3. See if we're in "show desktop" mode */
if (showing && if (showing &&
window->display->showing_desktop && window->screen->showing_desktop &&
window->type != META_WINDOW_DESKTOP && window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK) window->type != META_WINDOW_DOCK)
{ {
@ -1609,8 +1607,8 @@ meta_window_minimize (MetaWindow *window)
void void
meta_window_unminimize (MetaWindow *window) meta_window_unminimize (MetaWindow *window)
{ {
if (window->display->showing_desktop) if (window->screen->showing_desktop)
meta_display_unshow_desktop (window->display); meta_screen_unshow_desktop (window->screen);
if (window->minimized) if (window->minimized)
{ {
@ -1836,10 +1834,10 @@ meta_window_activate (MetaWindow *window,
guint32 timestamp) guint32 timestamp)
{ {
/* disable show desktop mode unless we're a desktop component */ /* disable show desktop mode unless we're a desktop component */
if (window->display->showing_desktop && if (window->screen->showing_desktop &&
window->type != META_WINDOW_DESKTOP && window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK) window->type != META_WINDOW_DOCK)
meta_display_unshow_desktop (window->display); meta_screen_unshow_desktop (window->screen);
/* Get window on current workspace */ /* Get window on current workspace */
if (!meta_window_visible_on_workspace (window, if (!meta_window_visible_on_workspace (window,
@ -2957,7 +2955,7 @@ meta_window_get_net_wm_desktop (MetaWindow *window)
g_list_length (window->workspaces) > 1) g_list_length (window->workspaces) > 1)
return 0xFFFFFFFF; return 0xFFFFFFFF;
else else
return meta_workspace_screen_index (window->workspaces->data); return meta_workspace_index (window->workspaces->data);
} }
int int
@ -3274,9 +3272,8 @@ meta_window_client_message (MetaWindow *window,
window->desc, space); window->desc, space);
workspace = workspace =
meta_display_get_workspace_by_screen_index (display, meta_screen_get_workspace_by_index (window->screen,
window->screen, space);
space);
if (workspace) if (workspace)
{ {
@ -4984,7 +4981,7 @@ static GList*
meta_window_get_workspaces (MetaWindow *window) meta_window_get_workspaces (MetaWindow *window)
{ {
if (window->on_all_workspaces) if (window->on_all_workspaces)
return window->display->workspaces; return window->screen->workspaces;
else else
return window->workspaces; return window->workspaces;
} }
@ -5864,9 +5861,8 @@ menu_callback (MetaWindowMenu *menu,
MetaWorkspace *workspace; MetaWorkspace *workspace;
workspace = workspace =
meta_display_get_workspace_by_screen_index (window->display, meta_screen_get_workspace_by_index (window->screen,
window->screen, workspace_index);
workspace_index);
if (workspace) if (workspace)
{ {
@ -5983,7 +5979,7 @@ meta_window_show_menu (MetaWindow *window,
meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp); meta_ui_window_menu_popup (menu, root_x, root_y, button, timestamp);
} }
static void static gboolean
window_query_root_pointer (MetaWindow *window, window_query_root_pointer (MetaWindow *window,
int *x, int *y) int *x, int *y)
{ {
@ -6010,6 +6006,8 @@ window_query_root_pointer (MetaWindow *window,
*x = root_x_return; *x = root_x_return;
if (y) if (y)
*y = root_y_return; *y = root_y_return;
return root_return == window->screen->xroot;
} }
static void static void
@ -6167,8 +6165,9 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
case META_GRAB_OP_MOVING: case META_GRAB_OP_MOVING:
case META_GRAB_OP_KEYBOARD_MOVING: case META_GRAB_OP_KEYBOARD_MOVING:
clear_moveresize_time (window); clear_moveresize_time (window);
update_move (window, event->xbutton.state, if (event->xbutton.root == window->screen->xroot)
event->xbutton.x_root, event->xbutton.y_root); update_move (window, event->xbutton.state,
event->xbutton.x_root, event->xbutton.y_root);
break; break;
case META_GRAB_OP_RESIZING_E: case META_GRAB_OP_RESIZING_E:
@ -6188,7 +6187,8 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
case META_GRAB_OP_KEYBOARD_RESIZING_SW: case META_GRAB_OP_KEYBOARD_RESIZING_SW:
case META_GRAB_OP_KEYBOARD_RESIZING_NW: case META_GRAB_OP_KEYBOARD_RESIZING_NW:
clear_moveresize_time (window); clear_moveresize_time (window);
update_resize (window, event->xbutton.x_root, event->xbutton.y_root); if (event->xbutton.root == window->screen->xroot)
update_resize (window, event->xbutton.x_root, event->xbutton.y_root);
break; break;
default: default:
@ -6205,10 +6205,10 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
case META_GRAB_OP_KEYBOARD_MOVING: case META_GRAB_OP_KEYBOARD_MOVING:
{ {
int x, y; int x, y;
window_query_root_pointer (window, &x, &y); if (window_query_root_pointer (window, &x, &y))
update_move (window, update_move (window,
event->xbutton.state, event->xbutton.state,
x, y); x, y);
} }
break; break;
@ -6230,8 +6230,8 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
case META_GRAB_OP_KEYBOARD_RESIZING_NW: case META_GRAB_OP_KEYBOARD_RESIZING_NW:
{ {
int x, y; int x, y;
window_query_root_pointer (window, &x, &y); if (window_query_root_pointer (window, &x, &y))
update_resize (window, x, y); update_resize (window, x, y);
} }
break; break;

View File

@ -37,8 +37,8 @@ meta_workspace_new (MetaScreen *screen)
workspace = g_new (MetaWorkspace, 1); workspace = g_new (MetaWorkspace, 1);
workspace->screen = screen; workspace->screen = screen;
workspace->screen->display->workspaces = workspace->screen->workspaces =
g_list_append (workspace->screen->display->workspaces, workspace); g_list_append (workspace->screen->workspaces, workspace);
workspace->windows = NULL; workspace->windows = NULL;
workspace->work_area.x = 0; workspace->work_area.x = 0;
@ -83,8 +83,8 @@ meta_workspace_free (MetaWorkspace *workspace)
screen = workspace->screen; screen = workspace->screen;
workspace->screen->display->workspaces = workspace->screen->workspaces =
g_list_remove (workspace->screen->display->workspaces, workspace); g_list_remove (workspace->screen->workspaces, workspace);
g_free (workspace->name); g_free (workspace->name);
@ -234,7 +234,7 @@ meta_workspace_index (MetaWorkspace *workspace)
int i; int i;
i = 0; i = 0;
tmp = workspace->screen->display->workspaces; tmp = workspace->screen->workspaces;
while (tmp != NULL) while (tmp != NULL)
{ {
if (tmp->data == workspace) if (tmp->data == workspace)
@ -249,31 +249,6 @@ meta_workspace_index (MetaWorkspace *workspace)
return -1; /* compiler warnings */ return -1; /* compiler warnings */
} }
int
meta_workspace_screen_index (MetaWorkspace *workspace)
{
GList *tmp;
int i;
i = 0;
tmp = workspace->screen->display->workspaces;
while (tmp != NULL)
{
MetaWorkspace *w = tmp->data;
if (tmp->data == workspace)
return i;
if (w->screen == workspace->screen)
++i;
tmp = tmp->next;
}
meta_bug ("Workspace does not exist to index!\n");
return -1; /* compiler warnings */
}
/* get windows contained on workspace, including workspace->windows /* get windows contained on workspace, including workspace->windows
* and also sticky windows. * and also sticky windows.
*/ */
@ -309,7 +284,7 @@ set_active_space_hint (MetaScreen *screen)
{ {
unsigned long data[1]; unsigned long data[1];
data[0] = meta_workspace_screen_index (screen->active_workspace); data[0] = meta_workspace_index (screen->active_workspace);
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %ld\n", data[0]); meta_verbose ("Setting _NET_CURRENT_DESKTOP to %ld\n", data[0]);
@ -541,8 +516,8 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
meta_verbose ("Neighbor space is %d\n", i); meta_verbose ("Neighbor space is %d\n", i);
return meta_display_get_workspace_by_index (workspace->screen->display, return meta_screen_get_workspace_by_index (workspace->screen,
i); i);
} }
void void

View File

@ -60,7 +60,6 @@ gboolean meta_workspace_contains_window (MetaWorkspace *workspace,
MetaWindow *window); MetaWindow *window);
void meta_workspace_activate (MetaWorkspace *workspace); void meta_workspace_activate (MetaWorkspace *workspace);
int meta_workspace_index (MetaWorkspace *workspace); int meta_workspace_index (MetaWorkspace *workspace);
int meta_workspace_screen_index (MetaWorkspace *workspace);
GList* meta_workspace_list_windows (MetaWorkspace *workspace); GList* meta_workspace_list_windows (MetaWorkspace *workspace);
void meta_workspace_invalidate_work_area (MetaWorkspace *workspace); void meta_workspace_invalidate_work_area (MetaWorkspace *workspace);