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

@@ -261,7 +261,6 @@ meta_display_open (const char *name)
display->error_traps = 0;
display->error_trap_handler = NULL;
display->server_grab_count = 0;
display->workspaces = NULL;
display->pending_pings = NULL;
display->autoraise_timeout_id = 0;
@@ -269,8 +268,6 @@ meta_display_open (const char *name)
display->expected_focus_window = NULL;
display->mru_list = NULL;
display->showing_desktop = FALSE;
/* FIXME copy the checks from GDK probably */
display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL;
@@ -1539,9 +1536,8 @@ event_callback (XEvent *event,
space);
workspace =
meta_display_get_workspace_by_screen_index (display,
screen,
space);
meta_screen_get_workspace_by_index (screen,
space);
if (workspace)
meta_workspace_activate (workspace);
@@ -1569,9 +1565,9 @@ event_callback (XEvent *event,
meta_verbose ("Request to %s desktop\n", showing_desktop ? "show" : "hide");
if (showing_desktop)
meta_display_show_desktop (display);
meta_screen_show_desktop (screen);
else
meta_display_unshow_desktop (display);
meta_screen_unshow_desktop (screen);
}
else if (event->xclient.message_type ==
display->atom_metacity_restart_message)
@@ -2145,56 +2141,6 @@ meta_display_unregister_x_window (MetaDisplay *display,
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
meta_display_create_x_cursor (MetaDisplay *display,
MetaCursor cursor)
@@ -2712,31 +2658,6 @@ meta_display_increment_event_serial (MetaDisplay *display)
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
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
meta_display_queue_retheme_all_windows (MetaDisplay *display)
{