1
/* $Id: workspaces.c 23767 2006-11-06 22:03:38Z olivier $
1
/* $Id: workspaces.c 24099 2006-12-13 22:01:17Z olivier $
3
3
This program is free software; you can redistribute it and/or modify
4
4
it under the terms of the GNU General Public License as published by
175
177
/* returns TRUE if the workspace was changed, FALSE otherwise */
177
workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c)
179
workspaceMove (ScreenInfo *screen_info, int rowmod, int colmod, Client * c, Time timestamp)
179
181
int row, col, newrow, newcol, previous_ws, n;
181
workspaceGetPosition(screen_info, screen_info->current_ws, &row, &col);
182
newrow = modify_with_wrap(row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
183
newcol = modify_with_wrap(col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
184
n = workspaceGetNumber(screen_info, newrow, newcol);
183
workspaceGetPosition (screen_info, screen_info->current_ws, &row, &col);
184
newrow = modify_with_wrap (row, rowmod, screen_info->desktop_layout.rows, screen_info->params->wrap_layout);
185
newcol = modify_with_wrap (col, colmod, screen_info->desktop_layout.cols, screen_info->params->wrap_layout);
186
n = workspaceGetNumber (screen_info, newrow, newcol);
186
188
if (n == screen_info->current_ws)
191
193
previous_ws = screen_info->current_ws;
192
194
if ((n >= 0) && (n < screen_info->workspace_count))
194
workspaceSwitch(screen_info, n, c, TRUE);
196
workspaceSwitch (screen_info, n, c, TRUE, timestamp);
196
198
else if (screen_info->params->wrap_layout)
221
n = workspaceGetNumber(screen_info, newrow, newcol);
223
n = workspaceGetNumber (screen_info, newrow, newcol);
223
workspaceSwitch(screen_info, n, c, TRUE);
225
workspaceSwitch (screen_info, n, c, TRUE, timestamp);
226
228
return (screen_info->current_ws != previous_ws);
230
workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus)
232
workspaceSwitch (ScreenInfo *screen_info, int new_ws, Client * c2, gboolean update_focus, Time timestamp)
232
234
DisplayInfo *display_info;
233
235
Client *c, *new_focus;
271
myScreenGrabPointer (screen_info, EnterWindowMask, None, myDisplayGetCurrentTime (display_info));
273
myScreenGrabPointer (screen_info, EnterWindowMask, None, timestamp);
273
275
screen_info->previous_ws = screen_info->current_ws;
274
276
screen_info->current_ws = new_ws;
325
327
if (c == previous)
327
329
FLAG_SET (previous->xfwm_flags, XFWM_FLAG_FOCUS);
328
clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), FOCUS_IGNORE_MODAL);
330
clientSetFocus (screen_info, NULL, timestamp, FOCUS_IGNORE_MODAL);
330
332
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE) && !FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
345
347
if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
347
if ((!new_focus) && (c == previous) && (c->type & WINDOW_REGULAR_FOCUSABLE))
349
if ((!new_focus) && (c == previous) && clientSelectMask (c, 0, WINDOW_REGULAR_FOCUSABLE))
384
clientSetFocus (screen_info, new_focus, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG);
386
clientSetFocus (screen_info, new_focus, timestamp, NO_FOCUS_FLAG);
388
clientFocusTop (screen_info, WIN_LAYER_NORMAL);
390
clientFocusTop (screen_info, WIN_LAYER_NORMAL, timestamp);
392
myScreenUngrabPointer (screen_info, myDisplayGetCurrentTime (display_info));
394
myScreenUngrabPointer (screen_info, timestamp);
437
439
if (screen_info->current_ws > count - 1)
439
workspaceSwitch (screen_info, count - 1, NULL, TRUE);
441
workspaceSwitch (screen_info, count - 1, NULL, TRUE, myDisplayGetCurrentTime (display_info));
441
443
setNetWorkarea (display_info, screen_info->xroot, screen_info->workspace_count,
442
444
screen_info->width, screen_info->height, screen_info->margins);
443
445
/* Recompute the layout based on the (changed) number of desktops */
444
getDesktopLayout(display_info, screen_info->xroot, screen_info->workspace_count,
446
getDesktopLayout (display_info, screen_info->xroot, screen_info->workspace_count,
445
447
&screen_info->desktop_layout);