24 |
void |
void |
25 |
workspaceSwitch (int new_ws, Client * c2) |
workspaceSwitch (int new_ws, Client * c2) |
26 |
{ |
{ |
27 |
Client *c, *f = NULL; |
Client *c, *f = NULL; |
28 |
int i; |
int i; |
29 |
|
|
30 |
#ifdef DEBUG |
#ifdef DEBUG |
31 |
printf ("entering workspaceSwitch\n"); |
printf ("entering workspaceSwitch\n"); |
32 |
#endif |
#endif |
33 |
|
|
34 |
if (new_ws < 0 && wrap_workspaces) |
if (new_ws < 0 && wrap_workspaces) |
35 |
new_ws = workspace_count - 1; |
new_ws = workspace_count - 1; |
36 |
if (new_ws > workspace_count - 1 && wrap_workspaces) |
if (new_ws > workspace_count - 1 && wrap_workspaces) |
37 |
new_ws = 0; |
new_ws = 0; |
38 |
if (new_ws < 0 || new_ws > workspace_count - 1 || new_ws == workspace) |
if (new_ws < 0 || new_ws > workspace_count - 1 || new_ws == workspace) |
39 |
return; |
return; |
40 |
|
|
41 |
f = clientGetFocus (); |
f = clientGetFocus (); |
42 |
if (f) |
if (f) |
43 |
f->focus = True; |
f->focus = True; |
44 |
|
|
45 |
if (c2) |
if (c2) |
46 |
{ |
{ |
47 |
setGnomeHint (c2->window, win_workspace, new_ws); |
setGnomeHint (c2->window, win_workspace, new_ws); |
48 |
setGnomeHint (c2->window, net_atoms[NET_WM_DESKTOP], new_ws); |
setGnomeHint (c2->window, net_atoms[NET_WM_DESKTOP], new_ws); |
49 |
c2->win_workspace = new_ws; |
c2->win_workspace = new_ws; |
50 |
} |
} |
51 |
|
|
52 |
setGnomeHint (root, win_workspace, new_ws); |
setGnomeHint (root, win_workspace, new_ws); |
53 |
setGnomeHint (root, net_atoms[NET_CURRENT_DESKTOP], new_ws); |
setGnomeHint (root, net_atoms[NET_CURRENT_DESKTOP], new_ws); |
54 |
workspace = new_ws; |
workspace = new_ws; |
55 |
for (c = clients, i = 0; i < client_count; c = c->next, i++) |
for (c = clients, i = 0; i < client_count; c = c->next, i++) |
56 |
{ |
{ |
57 |
if (c->win_state & WIN_STATE_STICKY) |
if (c->win_state & WIN_STATE_STICKY) |
58 |
clientSetWorkspace (c, new_ws); |
clientSetWorkspace (c, new_ws); |
59 |
else |
else |
60 |
{ |
{ |
61 |
if (c->win_workspace == new_ws && |
if (c->win_workspace == new_ws && |
62 |
getWMState (c->window) != IconicState) |
getWMState (c->window) != IconicState) |
63 |
{ |
{ |
64 |
clientShow (c, False); |
clientShow (c, False); |
65 |
if (c->focus) |
if (c->focus) |
66 |
f = c; |
f = c; |
67 |
c->focus = False; |
c->focus = False; |
68 |
} |
} |
69 |
else |
else |
70 |
clientHide (c, False); |
clientHide (c, False); |
71 |
} |
} |
72 |
} |
} |
73 |
setGnomeHint (root, win_workspace, new_ws); |
setGnomeHint (root, win_workspace, new_ws); |
74 |
|
|
75 |
if (c2) |
if (c2) |
76 |
f = c2; |
f = c2; |
77 |
clientSetFocus (f, True); |
clientSetFocus (f, True); |
78 |
} |
} |
79 |
|
|
80 |
void |
void |
81 |
workspaceSetCount (int count) |
workspaceSetCount (int count) |
82 |
{ |
{ |
83 |
Client *c; |
Client *c; |
84 |
int i; |
int i; |
85 |
|
|
86 |
#ifdef DEBUG |
#ifdef DEBUG |
87 |
printf ("entering workspaceSetCount\n"); |
printf ("entering workspaceSetCount\n"); |
88 |
#endif |
#endif |
89 |
|
|
90 |
if (count < 1) |
if (count < 1) |
91 |
count = 1; |
count = 1; |
92 |
if (count == workspace_count) |
if (count == workspace_count) |
93 |
return; |
return; |
94 |
|
|
95 |
setGnomeHint (root, win_workspace_count, count); |
setGnomeHint (root, win_workspace_count, count); |
96 |
setGnomeHint (root, net_atoms[NET_NUMBER_OF_DESKTOPS], count); |
setGnomeHint (root, net_atoms[NET_NUMBER_OF_DESKTOPS], count); |
97 |
workspace_count = count; |
workspace_count = count; |
98 |
|
|
99 |
for (c = clients, i = 0; i < client_count; c = c->next, i++) |
for (c = clients, i = 0; i < client_count; c = c->next, i++) |
100 |
if (c->win_workspace > count - 1) |
if (c->win_workspace > count - 1) |
101 |
clientSetWorkspace (c, count - 1); |
clientSetWorkspace (c, count - 1); |
102 |
|
|
103 |
if (workspace > count - 1) |
if (workspace > count - 1) |
104 |
workspaceSwitch (count - 1, NULL); |
workspaceSwitch (count - 1, NULL); |
105 |
} |
} |
106 |
|
|
107 |
/**This must remain at the end of the file.********** |
/**This must remain at the end of the file.********** |
108 |
* vim600:set sw=2 ts=8: * |
* vim600:set sw=2 ts=2: * |
109 |
* vim600:set cindent cinoptions={1s,>2s,^-1s,n-1s: * |
* vim600:set cindent cinoptions={1s,>2s,^-1s,n-1s: * |
110 |
* vim600:set foldmethod=marker: * |
* vim600:set foldmethod=marker: * |
111 |
****************************************************/ |
****************************************************/ |