2001-06-06 00:47:37 -04:00
|
|
|
/* Metacity Workspaces */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2004-02-22 20:48:29 -05:00
|
|
|
* Copyright (C) 2003 Rob Adams
|
2005-10-08 15:38:54 -04:00
|
|
|
* Copyright (C) 2004, 2005 Elijah Newren
|
2001-06-06 00:47:37 -04:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
#include <config.h>
|
2001-06-06 00:47:37 -04:00
|
|
|
#include "workspace.h"
|
2001-06-09 01:14:43 -04:00
|
|
|
#include "errors.h"
|
2002-11-03 14:06:39 -05:00
|
|
|
#include "prefs.h"
|
2001-06-09 01:14:43 -04:00
|
|
|
#include <X11/Xatom.h>
|
2002-06-22 00:52:35 -04:00
|
|
|
#include <string.h>
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2005-02-02 13:46:09 -05:00
|
|
|
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
|
|
|
static void set_active_space_hint (MetaScreen *screen);
|
|
|
|
static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one,
|
|
|
|
Time timestamp);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2004-08-27 13:22:54 -04:00
|
|
|
static void
|
|
|
|
maybe_add_to_list (MetaScreen *screen, MetaWindow *window, gpointer data)
|
|
|
|
{
|
|
|
|
GList **mru_list = data;
|
|
|
|
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
*mru_list = g_list_prepend (*mru_list, window);
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_new (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
MetaWorkspace *workspace;
|
|
|
|
|
|
|
|
workspace = g_new (MetaWorkspace, 1);
|
|
|
|
|
|
|
|
workspace->screen = screen;
|
2002-10-16 16:12:24 -04:00
|
|
|
workspace->screen->workspaces =
|
|
|
|
g_list_append (workspace->screen->workspaces, workspace);
|
2001-06-06 00:47:37 -04:00
|
|
|
workspace->windows = NULL;
|
2003-08-15 18:09:55 -04:00
|
|
|
workspace->mru_list = NULL;
|
2004-08-27 13:22:54 -04:00
|
|
|
meta_screen_foreach_window (screen, maybe_add_to_list, &workspace->mru_list);
|
2001-06-07 01:18:10 -04:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
workspace->work_areas = NULL;
|
|
|
|
workspace->work_areas_invalid = TRUE;
|
|
|
|
workspace->all_work_areas.x = 0;
|
|
|
|
workspace->all_work_areas.y = 0;
|
|
|
|
workspace->all_work_areas.width = 0;
|
|
|
|
workspace->all_work_areas.height = 0;
|
2003-06-25 23:09:38 -04:00
|
|
|
|
|
|
|
workspace->left_struts = NULL;
|
|
|
|
workspace->right_struts = NULL;
|
|
|
|
workspace->top_struts = NULL;
|
|
|
|
workspace->bottom_struts = NULL;
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
|
|
|
|
workspace->showing_desktop = FALSE;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
return workspace;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_free (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
2001-12-09 22:55:26 -05:00
|
|
|
MetaScreen *screen;
|
|
|
|
|
|
|
|
g_return_if_fail (workspace != workspace->screen->active_workspace);
|
|
|
|
|
|
|
|
/* Here we assume all the windows are already on another workspace
|
|
|
|
* as well, so they won't be "orphaned"
|
|
|
|
*/
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
tmp = workspace->windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
GList *next;
|
2001-12-09 22:55:26 -05:00
|
|
|
MetaWindow *window = tmp->data;
|
2001-06-06 00:47:37 -04:00
|
|
|
next = tmp->next;
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
/* pop front of list we're iterating over */
|
|
|
|
meta_workspace_remove_window (workspace, window);
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
g_assert (window->workspace != NULL);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
tmp = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (workspace->windows == NULL);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
|
|
|
screen = workspace->screen;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
workspace->screen->workspaces =
|
|
|
|
g_list_remove (workspace->screen->workspaces, workspace);
|
2002-06-22 00:52:35 -04:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
g_free (workspace->work_areas);
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2003-12-17 11:01:00 -05:00
|
|
|
g_list_free (workspace->mru_list);
|
2003-06-25 23:09:38 -04:00
|
|
|
g_slist_free (workspace->left_struts);
|
|
|
|
g_slist_free (workspace->right_struts);
|
|
|
|
g_slist_free (workspace->top_struts);
|
|
|
|
g_slist_free (workspace->bottom_struts);
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
g_free (workspace);
|
2001-12-09 22:55:26 -05:00
|
|
|
|
2002-06-22 00:52:35 -04:00
|
|
|
/* don't bother to reset names, pagers can just ignore
|
|
|
|
* extra ones
|
|
|
|
*/
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_add_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
g_return_if_fail (window->workspace == NULL);
|
2001-06-09 23:17:15 -04:00
|
|
|
|
2003-12-14 14:19:40 -05:00
|
|
|
/* If the window is on all workspaces, we want to add it to all mru
|
|
|
|
* lists, otherwise just add it to this workspaces mru list
|
|
|
|
*/
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
{
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
if (window->workspace == NULL)
|
2003-12-14 14:19:40 -05:00
|
|
|
{
|
|
|
|
GList* tmp = window->screen->workspaces;
|
|
|
|
while (tmp)
|
|
|
|
{
|
|
|
|
MetaWorkspace* work = (MetaWorkspace*) tmp->data;
|
|
|
|
if (!g_list_find (work->mru_list, window))
|
2004-02-15 09:27:43 -05:00
|
|
|
work->mru_list = g_list_prepend (work->mru_list, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
2004-02-15 09:27:43 -05:00
|
|
|
workspace->mru_list = g_list_prepend (workspace->mru_list, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
workspace->windows = g_list_prepend (workspace->windows, window);
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
window->workspace = workspace;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
meta_window_set_current_workspace_hint (window);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_window_queue_calc_showing (window);
|
2003-06-25 23:09:38 -04:00
|
|
|
if (window->struts)
|
2002-02-07 22:34:26 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Invalidating work area of workspace %d since we're adding window %s to it\n",
|
|
|
|
meta_workspace_index (workspace), window->desc);
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
/* queue a move_resize since changing workspaces may change
|
|
|
|
* the relevant struts
|
|
|
|
*/
|
|
|
|
meta_window_queue_move_resize (window);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_remove_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *window)
|
|
|
|
{
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
g_return_if_fail (window->workspace == workspace);
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
workspace->windows = g_list_remove (workspace->windows, window);
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
window->workspace = NULL;
|
2003-12-14 14:19:40 -05:00
|
|
|
|
|
|
|
/* If the window is on all workspaces, we don't want to remove it
|
|
|
|
* from the MRU list unless this causes it to be removed from all
|
|
|
|
* workspaces
|
|
|
|
*/
|
|
|
|
if (window->on_all_workspaces)
|
|
|
|
{
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
GList* tmp = window->screen->workspaces;
|
|
|
|
while (tmp)
|
2003-12-14 14:19:40 -05:00
|
|
|
{
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
MetaWorkspace* work = (MetaWorkspace*) tmp->data;
|
|
|
|
work->mru_list = g_list_remove (work->mru_list, window);
|
2003-12-14 14:19:40 -05:00
|
|
|
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
tmp = tmp->next;
|
2003-12-14 14:19:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
workspace->mru_list = g_list_remove (workspace->mru_list, window);
|
|
|
|
g_assert (g_list_find (workspace->mru_list, window) == NULL);
|
|
|
|
}
|
2001-06-06 00:47:37 -04:00
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
meta_window_set_current_workspace_hint (window);
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_window_queue_calc_showing (window);
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2003-06-25 23:09:38 -04:00
|
|
|
if (window->struts)
|
2002-02-07 22:34:26 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Invalidating work area of workspace %d since we're removing window %s from it\n",
|
|
|
|
meta_workspace_index (workspace), window->desc);
|
|
|
|
meta_workspace_invalidate_work_area (workspace);
|
|
|
|
}
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
/* queue a move_resize since changing workspaces may change
|
|
|
|
* the relevant struts
|
|
|
|
*/
|
|
|
|
meta_window_queue_move_resize (window);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
void
|
|
|
|
meta_workspace_relocate_windows (MetaWorkspace *workspace,
|
|
|
|
MetaWorkspace *new_home)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
|
|
|
g_return_if_fail (workspace != new_home);
|
|
|
|
|
|
|
|
/* can't modify list we're iterating over */
|
|
|
|
copy = g_list_copy (workspace->windows);
|
|
|
|
|
|
|
|
tmp = copy;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
|
|
|
meta_workspace_add_window (new_home, window);
|
|
|
|
meta_workspace_remove_window (workspace, window);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
|
|
|
|
g_assert (workspace->windows == NULL);
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
void
|
|
|
|
meta_workspace_queue_calc_showing (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
tmp = workspace->windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
meta_window_queue_calc_showing (tmp->data);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-05-30 16:24:00 -04:00
|
|
|
meta_workspace_activate_with_focus (MetaWorkspace *workspace,
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
MetaWindow *focus_this,
|
|
|
|
Time timestamp)
|
2001-06-06 00:47:37 -04:00
|
|
|
{
|
|
|
|
MetaWorkspace *old;
|
2004-02-15 00:29:49 -05:00
|
|
|
MetaWindow *move_window;
|
2001-06-06 00:47:37 -04:00
|
|
|
|
|
|
|
meta_verbose ("Activating workspace %d\n",
|
|
|
|
meta_workspace_index (workspace));
|
|
|
|
|
|
|
|
if (workspace->screen->active_workspace == workspace)
|
|
|
|
return;
|
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
/* Note that old can be NULL; e.g. when starting up */
|
2001-06-06 00:47:37 -04:00
|
|
|
old = workspace->screen->active_workspace;
|
|
|
|
|
|
|
|
workspace->screen->active_workspace = workspace;
|
|
|
|
|
2001-06-09 23:17:15 -04:00
|
|
|
set_active_space_hint (workspace->screen);
|
2002-08-04 16:17:37 -04:00
|
|
|
|
Make the "showing desktop" mode be per-workspace instead of per-screen.
2004-10-16 Elijah Newren <newren@math.utah.edu>
Make the "showing desktop" mode be per-workspace instead of
per-screen. (fixes #142198)
* src/keybindings.c (handle_toggle_desktop): access
showing_desktop through the active workspace
* src/screen.c (meta_screen_new): remove initialization of
screen->showing_desktop,
(meta_screen_update_showing_desktop_hint): rename and make not
static and access showing_desktop through the active workspace,
(queue_windows_showing): replace meta_display_list_windows() with
screen->active_workspace->windows,
(meta_screen_minimize_all_on_active_workspace_except): renamed
from meta_screen_minimize_all_except since it now only works on
the active workspace, (meta_screen_show_desktop,
meta_screen_unshow_desktop): access showing_desktop through the
active workspace
* src/screen.h (struct _MetaScreen): remove showing_desktop field,
(meta_screen_minimize_all_on_active_workspace_except): rename from
meta_screen_minimize_all_except,
(meta_screen_update)_showing_desktop_hint): export this function too
* src/window.c (maybe_leave_show_desktop_mode): access
showing_desktop through the active workspace and use new name for
meta_screen_minimize_all_on_active_workspace_except,
(window_should_be_showing): access showing_desktop through the
active workspace
* src/workspace.c (meta_workspace_new): initialize
workspace->showing_desktop, (meta_workspace_activate_with_focus):
add note that old can be NULL, update showing_desktop_hint if
different on this workspace than the previous one
* src/workspace.h (struct _MetaWorkspace): add showing_desktop
field
2004-10-17 00:28:29 -04:00
|
|
|
/* If the "show desktop" mode is active for either the old workspace
|
|
|
|
* or the new one *but not both*, then update the
|
|
|
|
* _net_showing_desktop hint
|
|
|
|
*/
|
|
|
|
if (old && (old->showing_desktop ^ workspace->showing_desktop))
|
|
|
|
meta_screen_update_showing_desktop_hint (workspace->screen);
|
|
|
|
|
2002-08-04 16:17:37 -04:00
|
|
|
if (old == NULL)
|
|
|
|
return;
|
|
|
|
|
2004-02-15 00:29:49 -05:00
|
|
|
move_window = NULL;
|
|
|
|
if (workspace->screen->display->grab_op == META_GRAB_OP_MOVING ||
|
|
|
|
workspace->screen->display->grab_op == META_GRAB_OP_KEYBOARD_MOVING)
|
|
|
|
move_window = workspace->screen->display->grab_window;
|
|
|
|
|
|
|
|
if (move_window != NULL)
|
|
|
|
{
|
|
|
|
if (move_window->on_all_workspaces)
|
|
|
|
move_window = NULL; /* don't move it after all */
|
|
|
|
|
|
|
|
/* We put the window on the new workspace, flip spaces,
|
|
|
|
* then remove from old workspace, so the window
|
|
|
|
* never gets unmapped and we maintain the button grab
|
|
|
|
* on it.
|
|
|
|
*/
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
if (move_window && (move_window->workspace != workspace))
|
2004-02-15 00:29:49 -05:00
|
|
|
{
|
Partially resolve the conflicting requirements of windows on multiple
2004-12-22 Elijah Newren <newren@gmail.com>
Partially resolve the conflicting requirements of windows on
multiple workspaces and hidden being a global quantity for windows
(fixes bug 156182; the remainder of the work is bug 87531 and is a
libwnck issue)
* src/display.c (event_callback):
* src/window.c (meta_window_visible_on_workspace, meta_window_unstick):
* src/workspace.c (meta_workspace_add_window,
meta_workspace_contains_window,
meta_workspace_queue_calc_showing):
* src/workspace.h:
Remove meta_workspace_contains_window, replace with simple
comparison utilizing window->workspace
* src/place.c (meta_window_place):
* src/window.c (meta_window_shares_some_workspace):
* src/window.h:
Remove meta_window_shares_some_workspace, replace with a simple
comparison utilizing window->workspace
* src/session.c (save_state),
* src/window.c (meta_window_new_with_attrs,
meta_window_apply_session_info, meta_window_free,
window_showing_on_its_workspace,
meta_window_change_workspace_without_transients,
meta_window_unstick, meta_window_set_current_workspace_hint,
meta_window_get_workspaces):
* src/window.h:
* src/workspace.c (meta_workspace_free, meta_workspace_add_window,
meta_workspace_remove_window):
Only one workspace now
2004-12-22 18:52:52 -05:00
|
|
|
meta_workspace_remove_window (workspace, move_window);
|
|
|
|
meta_workspace_add_window (workspace, move_window);
|
2004-02-15 00:29:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-06 00:47:37 -04:00
|
|
|
meta_workspace_queue_calc_showing (old);
|
|
|
|
meta_workspace_queue_calc_showing (workspace);
|
2002-01-03 18:28:19 -05:00
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
/* FIXME: Why do we need this?!? Isn't it handled in the lines above? */
|
2004-02-15 00:29:49 -05:00
|
|
|
if (move_window)
|
|
|
|
/* Removes window from other spaces */
|
|
|
|
meta_window_change_workspace (move_window, workspace);
|
|
|
|
|
2003-05-30 16:24:00 -04:00
|
|
|
if (focus_this)
|
|
|
|
{
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_window_focus (focus_this, timestamp);
|
2003-05-30 16:24:00 -04:00
|
|
|
meta_window_raise (focus_this);
|
|
|
|
}
|
2004-02-15 00:29:49 -05:00
|
|
|
else if (move_window)
|
|
|
|
{
|
|
|
|
meta_window_raise (move_window);
|
|
|
|
}
|
2003-05-30 16:24:00 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS, "Focusing default window on new workspace\n");
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_workspace_focus_default_window (workspace, NULL, timestamp);
|
2003-05-30 16:24:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_workspace_activate (MetaWorkspace *workspace,
|
|
|
|
Time timestamp)
|
2003-05-30 16:24:00 -04:00
|
|
|
{
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_workspace_activate_with_focus (workspace, NULL, timestamp);
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_workspace_index (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2002-10-16 16:12:24 -04:00
|
|
|
tmp = workspace->screen->workspaces;
|
2001-06-06 00:47:37 -04:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
if (tmp->data == workspace)
|
|
|
|
return i;
|
|
|
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_bug ("Workspace does not exist to index!\n");
|
2002-09-12 16:46:03 -04:00
|
|
|
return -1; /* compiler warnings */
|
2001-06-06 00:47:37 -04:00
|
|
|
}
|
2001-06-09 01:14:43 -04:00
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
/* get windows contained on workspace, including workspace->windows
|
|
|
|
* and also sticky windows.
|
|
|
|
*/
|
|
|
|
GList*
|
|
|
|
meta_workspace_list_windows (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GSList *display_windows;
|
|
|
|
GSList *tmp;
|
|
|
|
GList *workspace_windows;
|
|
|
|
|
|
|
|
display_windows = meta_display_list_windows (workspace->screen->display);
|
|
|
|
|
|
|
|
workspace_windows = NULL;
|
|
|
|
tmp = display_windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *window = tmp->data;
|
|
|
|
|
2004-12-22 19:20:33 -05:00
|
|
|
if (meta_window_located_on_workspace (window, workspace))
|
2002-01-10 01:31:31 -05:00
|
|
|
workspace_windows = g_list_prepend (workspace_windows,
|
|
|
|
window);
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_slist_free (display_windows);
|
|
|
|
|
|
|
|
return workspace_windows;
|
|
|
|
}
|
|
|
|
|
2002-10-21 17:44:35 -04:00
|
|
|
static void
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
set_active_space_hint (MetaScreen *screen)
|
|
|
|
{
|
|
|
|
unsigned long data[1];
|
2002-11-20 23:48:53 -05:00
|
|
|
|
|
|
|
/* this is because we destroy the spaces in order,
|
|
|
|
* so we always end up setting a current desktop of
|
|
|
|
* 0 when closing a screen, so lose the current desktop
|
|
|
|
* on restart. By doing this we keep the current
|
|
|
|
* desktop on restart.
|
|
|
|
*/
|
|
|
|
if (screen->closing > 0)
|
|
|
|
return;
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
|
2002-10-16 16:12:24 -04:00
|
|
|
data[0] = meta_workspace_index (screen->active_workspace);
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
|
|
|
|
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %ld\n", data[0]);
|
|
|
|
|
|
|
|
meta_error_trap_push (screen->display);
|
|
|
|
XChangeProperty (screen->display->xdisplay, screen->xroot,
|
|
|
|
screen->display->atom_net_current_desktop,
|
|
|
|
XA_CARDINAL,
|
|
|
|
32, PropModeReplace, (guchar*) data, 1);
|
2002-10-21 17:44:35 -04:00
|
|
|
meta_error_trap_pop (screen->display, FALSE);
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
}
|
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
void
|
|
|
|
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
2002-02-08 01:01:58 -05:00
|
|
|
GList *windows;
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
if (workspace->work_areas_invalid)
|
2002-02-07 22:34:26 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Work area for workspace %d is already invalid\n",
|
|
|
|
meta_workspace_index (workspace));
|
|
|
|
return;
|
|
|
|
}
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Invalidating work area for workspace %d\n",
|
|
|
|
meta_workspace_index (workspace));
|
2003-02-23 12:09:46 -05:00
|
|
|
|
|
|
|
g_free (workspace->work_areas);
|
|
|
|
workspace->work_areas = NULL;
|
2003-06-28 12:12:32 -04:00
|
|
|
|
|
|
|
g_slist_free (workspace->left_struts);
|
|
|
|
workspace->left_struts = NULL;
|
|
|
|
g_slist_free (workspace->right_struts);
|
|
|
|
workspace->right_struts = NULL;
|
|
|
|
g_slist_free (workspace->top_struts);
|
|
|
|
workspace->top_struts = NULL;
|
|
|
|
g_slist_free (workspace->bottom_struts);
|
|
|
|
workspace->bottom_struts = NULL;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
workspace->work_areas_invalid = TRUE;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
|
|
|
/* redo the size/position constraints on all windows */
|
2002-02-08 01:01:58 -05:00
|
|
|
windows = meta_workspace_list_windows (workspace);
|
|
|
|
tmp = windows;
|
2002-01-10 01:31:31 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
|
|
|
meta_window_queue_move_resize (w);
|
2002-02-08 01:01:58 -05:00
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
2002-02-08 01:01:58 -05:00
|
|
|
|
|
|
|
g_list_free (windows);
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
|
2002-06-24 21:12:37 -04:00
|
|
|
meta_screen_queue_workarea_recalc (workspace->screen);
|
2002-01-10 01:31:31 -05:00
|
|
|
}
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
static void
|
|
|
|
ensure_work_areas_validated (MetaWorkspace *workspace)
|
|
|
|
{
|
|
|
|
int left_strut = 0;
|
|
|
|
int right_strut = 0;
|
|
|
|
int top_strut = 0;
|
|
|
|
int bottom_strut = 0;
|
|
|
|
int all_left_strut = 0;
|
|
|
|
int all_right_strut = 0;
|
|
|
|
int all_top_strut = 0;
|
|
|
|
int all_bottom_strut = 0;
|
|
|
|
int i;
|
|
|
|
GList *tmp;
|
|
|
|
GList *windows;
|
|
|
|
|
|
|
|
if (!workspace->work_areas_invalid)
|
|
|
|
return;
|
2003-06-25 23:09:38 -04:00
|
|
|
|
2003-06-28 12:12:32 -04:00
|
|
|
g_assert (workspace->top_struts == NULL);
|
|
|
|
g_assert (workspace->bottom_struts == NULL);
|
|
|
|
g_assert (workspace->left_struts == NULL);
|
|
|
|
g_assert (workspace->right_struts == NULL);
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
windows = meta_workspace_list_windows (workspace);
|
|
|
|
|
|
|
|
g_free (workspace->work_areas);
|
|
|
|
workspace->work_areas = g_new (MetaRectangle,
|
|
|
|
workspace->screen->n_xinerama_infos);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < workspace->screen->n_xinerama_infos)
|
2002-01-10 01:31:31 -05:00
|
|
|
{
|
2003-02-23 12:09:46 -05:00
|
|
|
left_strut = 0;
|
|
|
|
right_strut = 0;
|
|
|
|
top_strut = 0;
|
|
|
|
bottom_strut = 0;
|
|
|
|
|
2002-01-10 01:31:31 -05:00
|
|
|
tmp = windows;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaWindow *w = tmp->data;
|
|
|
|
|
2003-06-25 23:09:38 -04:00
|
|
|
if (w->struts)
|
2002-01-10 01:31:31 -05:00
|
|
|
{
|
2002-04-22 14:18:38 -04:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2003-02-23 12:09:46 -05:00
|
|
|
"Merging win %s with %d %d %d %d "
|
|
|
|
"with %d %d %d %d\n",
|
2002-04-22 14:18:38 -04:00
|
|
|
w->desc,
|
2003-06-25 23:09:38 -04:00
|
|
|
w->struts->left.width, w->struts->right.width,
|
|
|
|
w->struts->top.height, w->struts->bottom.height,
|
2003-02-23 12:09:46 -05:00
|
|
|
left_strut, right_strut,
|
|
|
|
top_strut, bottom_strut);
|
|
|
|
|
2003-06-25 23:09:38 -04:00
|
|
|
if ((i == 0) && (w->struts->left.width > 0))
|
|
|
|
{
|
|
|
|
workspace->left_struts = g_slist_prepend (workspace->left_struts,
|
|
|
|
&w->struts->left);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (meta_screen_rect_intersects_xinerama (w->screen,
|
|
|
|
&w->struts->left,
|
|
|
|
i))
|
|
|
|
{
|
|
|
|
left_strut = MAX (left_strut,
|
|
|
|
w->struts->left.width -
|
|
|
|
workspace->screen->xinerama_infos[i].x_origin);
|
|
|
|
all_left_strut = MAX (all_left_strut, w->struts->left.width);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((i == 0) && (w->struts->right.width > 0))
|
|
|
|
{
|
|
|
|
workspace->right_struts = g_slist_prepend (workspace->right_struts,
|
2003-09-20 00:58:25 -04:00
|
|
|
&w->struts->right);
|
2003-06-25 23:09:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (meta_screen_rect_intersects_xinerama (w->screen,
|
|
|
|
&w->struts->right,
|
|
|
|
i))
|
|
|
|
{
|
2003-09-20 00:58:25 -04:00
|
|
|
right_strut = MAX (right_strut, w->struts->right.width -
|
|
|
|
workspace->screen->width +
|
|
|
|
workspace->screen->xinerama_infos[i].width +
|
|
|
|
workspace->screen->xinerama_infos[i].x_origin);
|
2003-06-25 23:09:38 -04:00
|
|
|
all_right_strut = MAX (all_right_strut, w->struts->right.width);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((i == 0) && (w->struts->top.height > 0))
|
|
|
|
{
|
|
|
|
workspace->top_struts = g_slist_prepend (workspace->top_struts,
|
|
|
|
&w->struts->top);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (meta_screen_rect_intersects_xinerama (w->screen,
|
|
|
|
&w->struts->top,
|
|
|
|
i))
|
|
|
|
{
|
|
|
|
top_strut = MAX (top_strut,
|
|
|
|
w->struts->top.height -
|
|
|
|
workspace->screen->xinerama_infos[i].y_origin);
|
|
|
|
all_top_strut = MAX (all_top_strut, w->struts->top.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((i == 0) && (w->struts->bottom.height > 0))
|
|
|
|
{
|
|
|
|
workspace->bottom_struts = g_slist_prepend (workspace->bottom_struts,
|
|
|
|
&w->struts->bottom);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (meta_screen_rect_intersects_xinerama (w->screen,
|
|
|
|
&w->struts->bottom,
|
|
|
|
i))
|
|
|
|
{
|
2003-09-20 00:58:25 -04:00
|
|
|
bottom_strut = MAX (bottom_strut, w->struts->bottom.height -
|
|
|
|
workspace->screen->height +
|
|
|
|
workspace->screen->xinerama_infos[i].height +
|
|
|
|
workspace->screen->xinerama_infos[i].y_origin);
|
2003-06-25 23:09:38 -04:00
|
|
|
all_bottom_strut = MAX (all_bottom_strut, w->struts->bottom.height);
|
|
|
|
}
|
2002-01-10 01:31:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Some paranoid robustness */
|
|
|
|
#define MIN_SANE_AREA 100
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
if ((left_strut + right_strut) >
|
|
|
|
(workspace->screen->xinerama_infos[i].width - MIN_SANE_AREA))
|
2002-01-10 01:31:31 -05:00
|
|
|
{
|
2002-04-22 14:18:38 -04:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2003-02-23 12:09:46 -05:00
|
|
|
"Making left/right struts %d %d sane xinerama %d\n",
|
|
|
|
left_strut, right_strut, i);
|
|
|
|
left_strut = (workspace->screen->xinerama_infos[i].width -
|
|
|
|
MIN_SANE_AREA) / 2;
|
2002-01-10 01:31:31 -05:00
|
|
|
right_strut = left_strut;
|
|
|
|
}
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
if ((top_strut + bottom_strut) >
|
|
|
|
(workspace->screen->xinerama_infos[i].height - MIN_SANE_AREA))
|
2002-01-10 01:31:31 -05:00
|
|
|
{
|
2002-04-22 14:18:38 -04:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2003-02-23 12:09:46 -05:00
|
|
|
"Making top/bottom struts %d %d sane xinerama %d\n",
|
|
|
|
top_strut, bottom_strut, i);
|
|
|
|
top_strut = (workspace->screen->xinerama_infos[i].height -
|
|
|
|
MIN_SANE_AREA) / 2;
|
2002-01-10 01:31:31 -05:00
|
|
|
bottom_strut = top_strut;
|
|
|
|
}
|
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
workspace->work_areas[i].x =
|
|
|
|
left_strut + workspace->screen->xinerama_infos[i].x_origin;
|
|
|
|
workspace->work_areas[i].y = top_strut +
|
|
|
|
workspace->screen->xinerama_infos[i].y_origin;
|
|
|
|
workspace->work_areas[i].width =
|
|
|
|
workspace->screen->xinerama_infos[i].width -
|
|
|
|
left_strut - right_strut;
|
|
|
|
workspace->work_areas[i].height =
|
|
|
|
workspace->screen->xinerama_infos[i].height -
|
|
|
|
top_strut - bottom_strut;
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
2003-06-25 23:09:38 -04:00
|
|
|
"Computed work area for workspace %d "
|
2003-02-23 12:09:46 -05:00
|
|
|
"xinerama %d: %d,%d %d x %d\n",
|
2002-02-07 22:34:26 -05:00
|
|
|
meta_workspace_index (workspace),
|
2003-02-23 12:09:46 -05:00
|
|
|
i,
|
|
|
|
workspace->work_areas[i].x,
|
|
|
|
workspace->work_areas[i].y,
|
|
|
|
workspace->work_areas[i].width,
|
|
|
|
workspace->work_areas[i].height);
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (windows);
|
|
|
|
|
|
|
|
if ((all_left_strut + all_right_strut) >
|
|
|
|
(workspace->screen->width - MIN_SANE_AREA))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Making screen-wide left/right struts %d %d sane\n",
|
|
|
|
all_left_strut, all_right_strut);
|
|
|
|
all_left_strut = (workspace->screen->width - MIN_SANE_AREA) / 2;
|
|
|
|
all_right_strut = all_left_strut;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((all_top_strut + all_bottom_strut) >
|
|
|
|
(workspace->screen->height - MIN_SANE_AREA))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Making top/bottom struts %d %d sane\n",
|
|
|
|
all_top_strut, all_bottom_strut);
|
|
|
|
all_top_strut = (workspace->screen->height - MIN_SANE_AREA) / 2;
|
|
|
|
all_bottom_strut = all_top_strut;
|
|
|
|
}
|
|
|
|
|
|
|
|
workspace->all_work_areas.x = all_left_strut;
|
|
|
|
workspace->all_work_areas.y = all_top_strut;
|
|
|
|
workspace->all_work_areas.width =
|
|
|
|
workspace->screen->width - all_left_strut - all_right_strut;
|
|
|
|
workspace->all_work_areas.height =
|
|
|
|
workspace->screen->height - all_top_strut - all_bottom_strut;
|
|
|
|
|
|
|
|
workspace->work_areas_invalid = FALSE;
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_WORKAREA,
|
|
|
|
"Computed work area for workspace %d: %d,%d %d x %d\n",
|
|
|
|
meta_workspace_index (workspace),
|
|
|
|
workspace->all_work_areas.x,
|
|
|
|
workspace->all_work_areas.y,
|
|
|
|
workspace->all_work_areas.width,
|
|
|
|
workspace->all_work_areas.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_get_work_area_for_xinerama (MetaWorkspace *workspace,
|
|
|
|
int which_xinerama,
|
|
|
|
MetaRectangle *area)
|
|
|
|
{
|
|
|
|
g_assert (which_xinerama >= 0);
|
2002-01-10 01:31:31 -05:00
|
|
|
|
2003-02-23 12:09:46 -05:00
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
g_assert (which_xinerama < workspace->screen->n_xinerama_infos);
|
|
|
|
|
|
|
|
*area = workspace->work_areas[which_xinerama];
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_get_work_area_all_xineramas (MetaWorkspace *workspace,
|
|
|
|
MetaRectangle *area)
|
|
|
|
{
|
|
|
|
ensure_work_areas_validated (workspace);
|
|
|
|
|
|
|
|
*area = workspace->all_work_areas;
|
2002-01-10 01:31:31 -05:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2002-11-07 18:13:12 -05:00
|
|
|
static char *
|
|
|
|
meta_motion_direction_to_string (MetaMotionDirection direction)
|
|
|
|
{
|
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case META_MOTION_UP:
|
|
|
|
return "Up";
|
|
|
|
case META_MOTION_DOWN:
|
|
|
|
return "Down";
|
|
|
|
case META_MOTION_LEFT:
|
|
|
|
return "Left";
|
|
|
|
case META_MOTION_RIGHT:
|
|
|
|
return "Right";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Unknown";
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-11-07 18:13:12 -05:00
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
MetaWorkspace*
|
|
|
|
meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
|
|
|
MetaMotionDirection direction)
|
|
|
|
{
|
2003-01-05 13:36:01 -05:00
|
|
|
MetaWorkspaceLayout layout;
|
|
|
|
int i, current_space, num_workspaces;
|
|
|
|
|
|
|
|
current_space = meta_workspace_index (workspace);
|
2002-06-08 23:44:16 -04:00
|
|
|
num_workspaces = meta_screen_get_n_workspaces (workspace->screen);
|
2002-11-05 14:25:06 -05:00
|
|
|
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
|
2003-01-05 13:36:01 -05:00
|
|
|
current_space, &layout);
|
2002-11-05 14:25:06 -05:00
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
meta_verbose ("Getting neighbor of %d in direction %s\n",
|
|
|
|
current_space, meta_motion_direction_to_string (direction));
|
2002-05-16 21:48:57 -04:00
|
|
|
|
2002-11-05 14:25:06 -05:00
|
|
|
switch (direction)
|
|
|
|
{
|
|
|
|
case META_MOTION_LEFT:
|
2003-01-05 13:36:01 -05:00
|
|
|
layout.current_col -= 1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
case META_MOTION_RIGHT:
|
2003-01-05 13:36:01 -05:00
|
|
|
layout.current_col += 1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
case META_MOTION_UP:
|
2003-01-05 13:36:01 -05:00
|
|
|
layout.current_row -= 1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
case META_MOTION_DOWN:
|
2003-01-05 13:36:01 -05:00
|
|
|
layout.current_row += 1;
|
2002-11-05 14:25:06 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-01-05 13:36:01 -05:00
|
|
|
if (layout.current_col < 0)
|
|
|
|
layout.current_col = 0;
|
|
|
|
if (layout.current_col >= layout.cols)
|
|
|
|
layout.current_col = layout.cols - 1;
|
|
|
|
if (layout.current_row < 0)
|
|
|
|
layout.current_row = 0;
|
|
|
|
if (layout.current_row >= layout.rows)
|
|
|
|
layout.current_row = layout.rows - 1;
|
|
|
|
|
|
|
|
i = layout.grid[layout.current_row * layout.cols + layout.current_col];
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
i = current_space;
|
|
|
|
|
|
|
|
if (i >= num_workspaces)
|
|
|
|
meta_bug ("calc_workspace_layout left an invalid (too-high) workspace number %d in the grid\n",
|
|
|
|
i);
|
|
|
|
|
|
|
|
meta_verbose ("Neighbor workspace is %d at row %d col %d\n",
|
|
|
|
i, layout.current_row, layout.current_col);
|
|
|
|
|
|
|
|
meta_screen_free_workspace_layout (&layout);
|
2002-05-16 00:03:36 -04:00
|
|
|
|
2002-11-07 18:13:12 -05:00
|
|
|
return meta_screen_get_workspace_by_index (workspace->screen, i);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
const char*
|
|
|
|
meta_workspace_get_name (MetaWorkspace *workspace)
|
2002-06-22 00:52:35 -04:00
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
return meta_prefs_get_workspace_name (meta_workspace_index (workspace));
|
2002-06-22 00:52:35 -04:00
|
|
|
}
|
2003-08-15 18:09:55 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_workspace_focus_default_window (MetaWorkspace *workspace,
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
MetaWindow *not_this_one,
|
|
|
|
Time timestamp)
|
2003-08-15 18:09:55 -04:00
|
|
|
{
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
meta_warning ("CurrentTime used to choose focus window; "
|
|
|
|
"focus window may not be correct.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-02-21 21:11:25 -05:00
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK ||
|
|
|
|
!workspace->screen->display->mouse_mode)
|
2005-02-02 13:46:09 -05:00
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
else
|
2004-06-24 16:02:46 -04:00
|
|
|
{
|
|
|
|
MetaWindow * window;
|
|
|
|
window = meta_screen_get_mouse_window (workspace->screen, not_this_one);
|
2004-08-02 15:23:03 -04:00
|
|
|
if (window &&
|
|
|
|
window->type != META_WINDOW_DOCK &&
|
|
|
|
window->type != META_WINDOW_DESKTOP)
|
2004-06-24 16:02:46 -04:00
|
|
|
{
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
if (timestamp == CurrentTime)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* We would like for this to never happen. However, if
|
|
|
|
* it does happen then we kludge since using CurrentTime
|
|
|
|
* can mean ugly race conditions--and we can avoid these
|
|
|
|
* by allowing EnterNotify events (which come with
|
|
|
|
* timestamps) to handle focus.
|
|
|
|
*/
|
2004-06-24 16:02:46 -04:00
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Not focusing mouse window %s because EnterNotify events should handle that\n", window->desc);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing mouse window %s\n", window->desc);
|
|
|
|
meta_window_focus (window, timestamp);
|
|
|
|
}
|
2004-10-04 17:09:08 -04:00
|
|
|
|
|
|
|
if (workspace->screen->display->autoraise_window != window &&
|
|
|
|
meta_prefs_get_auto_raise ())
|
|
|
|
{
|
|
|
|
meta_display_queue_autoraise_callback (workspace->screen->display,
|
|
|
|
window);
|
|
|
|
}
|
2004-06-24 16:02:46 -04:00
|
|
|
}
|
|
|
|
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_SLOPPY)
|
2005-02-02 13:46:09 -05:00
|
|
|
focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
|
2004-06-24 16:02:46 -04:00
|
|
|
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_MOUSE)
|
2004-08-06 14:13:55 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Setting focus to no_focus_window, since no valid "
|
|
|
|
"window to focus found.\n");
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_focus_the_no_focus_window (workspace->screen->display,
|
|
|
|
timestamp);
|
2004-08-06 14:13:55 -04:00
|
|
|
}
|
2004-06-24 16:02:46 -04:00
|
|
|
}
|
2003-08-15 18:09:55 -04:00
|
|
|
}
|
|
|
|
|
2005-02-02 13:46:09 -05:00
|
|
|
static gboolean
|
|
|
|
record_ancestor (MetaWindow *window,
|
|
|
|
void *data)
|
|
|
|
{
|
|
|
|
MetaWindow **result = data;
|
|
|
|
|
|
|
|
*result = window;
|
|
|
|
return FALSE; /* quit with the first ancestor we find */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Focus ancestor of not_this_one if there is one, otherwise focus the MRU
|
|
|
|
* window on active workspace
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
|
|
|
MetaWindow *not_this_one,
|
|
|
|
Time timestamp)
|
2003-08-15 18:09:55 -04:00
|
|
|
{
|
|
|
|
MetaWindow *window = NULL;
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
if (not_this_one)
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing MRU window excluding %s\n", not_this_one->desc);
|
2005-02-02 13:46:09 -05:00
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing MRU window\n");
|
|
|
|
|
|
|
|
/* First, check to see if we need to focus an ancestor of a window */
|
|
|
|
if (not_this_one)
|
|
|
|
{
|
|
|
|
MetaWindow *ancestor;
|
|
|
|
ancestor = NULL;
|
|
|
|
meta_window_foreach_ancestor (not_this_one, record_ancestor, &ancestor);
|
|
|
|
if (ancestor != NULL)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing %s, ancestor of %s\n",
|
|
|
|
ancestor->desc, not_this_one->desc);
|
|
|
|
|
|
|
|
meta_window_focus (ancestor, timestamp);
|
|
|
|
|
|
|
|
/* Also raise the window if in click-to-focus */
|
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK)
|
|
|
|
meta_window_raise (ancestor);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No ancestor, look for the MRU window */
|
2003-08-15 18:09:55 -04:00
|
|
|
tmp = workspace->mru_list;
|
|
|
|
|
|
|
|
while (tmp)
|
|
|
|
{
|
2004-08-02 15:23:03 -04:00
|
|
|
MetaWindow* tmp_window;
|
|
|
|
tmp_window = ((MetaWindow*) tmp->data);
|
|
|
|
if (tmp_window != not_this_one &&
|
2005-10-03 15:06:17 -04:00
|
|
|
meta_window_showing_on_its_workspace (tmp_window) &&
|
2004-08-02 15:23:03 -04:00
|
|
|
tmp_window->type != META_WINDOW_DOCK &&
|
|
|
|
tmp_window->type != META_WINDOW_DESKTOP)
|
2003-08-15 18:09:55 -04:00
|
|
|
{
|
|
|
|
window = tmp->data;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing workspace MRU window %s\n", window->desc);
|
|
|
|
|
Fix a variety of focus race conditions in all focus modes, or at least
2004-10-04 Elijah Newren <newren@math.utah.edu>
Fix a variety of focus race conditions in all focus modes, or at
least make them harder to trigger (fixes #152000)
* src/core.[ch] (meta_core_user_lower_and_unfocus): add a
timestamp parameter; pass it along to
meta_workspace_focus_default_window
* src/display.[ch] (meta_display_get_current_time_roundtrip): new
function
* src/display.c (event_callback): pass a timestamp to the
meta_workspace_activate and meta_workspace_focus_default_window
function calls
* src/frames.c (meta_frames_button_press_event): pass a timestamp
to meta_core_user_lower_and_unfocus
* src/keybindings.c (handle_activate_workspace): pass a timestamp
to meta_workspace_activate, (process_workspace_switch_grab): pass
a timestamp to meta_workspace_focus_default_window and
meta_workspace_activate, (handle_toggle_desktop): pass a timestamp
to meta_workspace_focus_default_window,
(do_handle_move_to_workspace): pass a timestamp to
meta_workspace_activate_with_focus, (handle_workspace_switch):
meta_workspace_activate
* src/screen.c (meta_screen_new): pass a timestamp to
meta_workspace_activate
* src/window.c (meta_window_free): pass a timestamp to
meta_workspace_focus_default_window, (idle_calc_showing): don't
increment the focus sentinel here, (meta_window_minimize): pass a
timestamp to meta_workspace_focus_default_window,
(meta_window_client_message), pass a timestamp to
meta_workspace_focus_default_window
* src/workspace.h (meta_workspace_activate): add timestamp
parameter, (meta_workspace_activate_with_focus): add timestamp
parameter, (meta_workspace_focus_default_window): add timestamp
parameter
* src/workspace.c (meta_workspace_focus_mru_window): make this
function take a timestamp and use it for meta_window_focus or
XSetInputFocus, (meta_workspace_activate_with_focus): make this
function take a timestamp and pass it along to meta_window_focus
and meta_workspace_focus_default_window,
(meta_workspace_activate): make this function take a timestamp and
pass it to meta_workspace_activate_with_focus),
(meta_workspace_focus_default_window): make this function take a
timestamp, warn if its 0 but try to handle that case sanely, and
pass the timestamp on to meta_window_focus or
meta_workspace_focus_mru_window or XSetInputFocus
2004-10-04 16:32:59 -04:00
|
|
|
meta_window_focus (window, timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
|
|
|
|
/* Also raise the window if in click-to-focus */
|
|
|
|
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK)
|
|
|
|
meta_window_raise (window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-09-15 12:53:20 -04:00
|
|
|
meta_topic (META_DEBUG_FOCUS, "No MRU window to focus found; focusing no_focus_window.\n");
|
2004-10-04 17:09:08 -04:00
|
|
|
meta_display_focus_the_no_focus_window (workspace->screen->display,
|
|
|
|
timestamp);
|
2003-08-15 18:09:55 -04:00
|
|
|
}
|
|
|
|
}
|