From: "Rodolfo García Peñas (kix)" <[email protected]>
The variable current_workspace, that contains the last used workspace
is moved to the global workspace properties.
Now the screen is not needed to know the workspace_count.
---
src/actions.c | 41 +++++++++++++++++++++--------------------
src/appicon.c | 18 +++++++++---------
src/balloon.c | 5 +++--
src/cycling.c | 4 +++-
src/defaults.c | 4 ++--
src/dock.c | 38 +++++++++++++++++++-------------------
src/event.c | 20 ++++++++++----------
src/misc.c | 6 ++++--
src/moveres.c | 34 +++++++++++++++++-----------------
src/placement.c | 12 +++++++-----
src/screen.h | 2 --
src/session.c | 4 ++--
src/startup.c | 2 +-
src/switchpanel.c | 4 +++-
src/window.c | 18 +++++++++---------
src/winmenu.c | 7 +++----
src/wmspec.c | 8 ++++----
src/workspace.c | 21 ++++++++++-----------
src/workspace.h | 1 +
src/xdnd.c | 2 +-
20 files changed, 129 insertions(+), 122 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 5ceb9d5..d261b69 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -56,6 +56,7 @@ int ignore_wks_change = 0;
extern Time LastTimestamp;
extern Time LastFocusChange;
extern Atom _XA_WM_TAKE_FOCUS;
+extern wks_info wks_nfo;
static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x,
int *new_y,
unsigned int *new_width, unsigned int
*new_height);
@@ -605,7 +606,7 @@ static void find_Maximus_geometry(WWindow *wwin, WArea
usableArea, int *new_x, i
/* The focused window is always the last in the list */
while (tmp->prev) {
/* ignore windows in other workspaces etc */
- if (tmp->prev->frame->workspace !=
wwin->screen_ptr->current_workspace
+ if (tmp->prev->frame->workspace != wks_nfo.current_workspace
|| tmp->prev->flags.miniaturized ||
tmp->prev->flags.hidden) {
tmp = tmp->prev;
continue;
@@ -632,7 +633,7 @@ static void find_Maximus_geometry(WWindow *wwin, WArea
usableArea, int *new_x, i
tmp = wwin;
while (tmp->prev) {
- if (tmp->prev->frame->workspace !=
wwin->screen_ptr->current_workspace
+ if (tmp->prev->frame->workspace != wks_nfo.current_workspace
|| tmp->prev->flags.miniaturized ||
tmp->prev->flags.hidden) {
tmp = tmp->prev;
continue;
@@ -1070,7 +1071,7 @@ void wIconifyWindow(WWindow * wwin)
return;
}
- present = wwin->frame->workspace == wwin->screen_ptr->current_workspace;
+ present = wwin->frame->workspace == wks_nfo.current_workspace;
/* if the window is in another workspace, simplify process */
if (present) {
@@ -1139,7 +1140,7 @@ void wIconifyWindow(WWindow * wwin)
wwin->flags.skip_next_animation = 0;
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
- if (wwin->screen_ptr->current_workspace ==
wwin->frame->workspace ||
+ if (wks_nfo.current_workspace == wwin->frame->workspace ||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
XMapWindow(dpy, wwin->icon->core->window);
@@ -1206,10 +1207,10 @@ void wDeiconifyWindow(WWindow *wwin)
/* we're hiding for show_desktop */
int netwm_hidden = wwin->flags.net_show_desktop &&
- wwin->frame->workspace != wwin->screen_ptr->current_workspace;
+ wwin->frame->workspace != wks_nfo.current_workspace;
if (!netwm_hidden)
- wWindowChangeWorkspace(wwin,
wwin->screen_ptr->current_workspace);
+ wWindowChangeWorkspace(wwin, wks_nfo.current_workspace);
if (!wwin->flags.miniaturized) {
ignore_wks_change = 0;
@@ -1402,7 +1403,7 @@ void wHideAll(WScreen *scr)
for (i = 0; i < wcount; i++) {
wwin = windows[i];
- if (wwin->frame->workspace == scr->current_workspace
+ if (wwin->frame->workspace == wks_nfo.current_workspace
&& !(wwin->flags.miniaturized || wwin->flags.hidden)
&& !wwin->flags.internal_window
&& !WFLAGP(wwin, no_miniaturizable)
@@ -1426,7 +1427,7 @@ void wHideOtherApplications(WWindow *awin)
while (wwin) {
if (wwin != awin
- && wwin->frame->workspace ==
awin->screen_ptr->current_workspace
+ && wwin->frame->workspace == wks_nfo.current_workspace
&& !(wwin->flags.miniaturized || wwin->flags.hidden)
&& !wwin->flags.internal_window
&& wGetWindowOfInspectorForWindow(wwin) != awin &&
!WFLAGP(wwin, no_hide_others)) {
@@ -1529,7 +1530,7 @@ void wHideApplication(WApplication *wapp)
static void unhideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin,
int animate, int bringToCurrentWS)
{
if (bringToCurrentWS)
- wWindowChangeWorkspace(wwin,
wwin->screen_ptr->current_workspace);
+ wWindowChangeWorkspace(wwin, wks_nfo.current_workspace);
wwin->flags.hidden = 0;
@@ -1542,7 +1543,7 @@ static void unhideWindow(WIcon *icon, int icon_x, int
icon_y, WWindow *wwin, int
}
#endif
wwin->flags.skip_next_animation = 0;
- if (wwin->screen_ptr->current_workspace == wwin->frame->workspace) {
+ if (wks_nfo.current_workspace == wwin->frame->workspace) {
XMapWindow(dpy, wwin->client_win);
XMapWindow(dpy, wwin->frame->core->window);
wClientSetState(wwin, NormalState, None);
@@ -1588,7 +1589,7 @@ void wUnhideApplication(WApplication *wapp, Bool
miniwindows, Bool bringToCurren
if (wlist->flags.miniaturized) {
if ((bringToCurrentWS ||
wPreferences.sticky_icons ||
- wlist->frame->workspace ==
scr->current_workspace) && wlist->icon) {
+ wlist->frame->workspace ==
wks_nfo.current_workspace) && wlist->icon) {
if (!wlist->icon->mapped) {
int x, y;
@@ -1604,18 +1605,18 @@ void wUnhideApplication(WApplication *wapp, Bool
miniwindows, Bool bringToCurren
wRaiseFrame(wlist->icon->core);
}
if (bringToCurrentWS)
- wWindowChangeWorkspace(wlist,
scr->current_workspace);
+ wWindowChangeWorkspace(wlist,
wks_nfo.current_workspace);
wlist->flags.hidden = 0;
- if (miniwindows && wlist->frame->workspace ==
scr->current_workspace) {
+ if (miniwindows && wlist->frame->workspace ==
wks_nfo.current_workspace) {
wDeiconifyWindow(wlist);
}
WMPostNotificationName(WMNChangedState, wlist,
"hide");
} else if (wlist->flags.shaded) {
if (bringToCurrentWS)
- wWindowChangeWorkspace(wlist,
scr->current_workspace);
+ wWindowChangeWorkspace(wlist,
wks_nfo.current_workspace);
wlist->flags.hidden = 0;
wRaiseFrame(wlist->frame->core);
- if (wlist->frame->workspace ==
scr->current_workspace) {
+ if (wlist->frame->workspace ==
wks_nfo.current_workspace) {
XMapWindow(dpy,
wlist->frame->core->window);
if (miniwindows) {
wUnshadeWindow(wlist);
@@ -1627,8 +1628,8 @@ void wUnhideApplication(WApplication *wapp, Bool
miniwindows, Bool bringToCurren
wapp->app_icon->y_pos, wlist,
animate, bringToCurrentWS);
animate = False;
} else {
- if (bringToCurrentWS && wlist->frame->workspace
!= scr->current_workspace) {
- wWindowChangeWorkspace(wlist,
scr->current_workspace);
+ if (bringToCurrentWS && wlist->frame->workspace
!= wks_nfo.current_workspace) {
+ wWindowChangeWorkspace(wlist,
wks_nfo.current_workspace);
}
wRaiseFrame(wlist->frame->core);
}
@@ -1662,7 +1663,7 @@ void wShowAllWindows(WScreen *scr)
old_foc = wwin = scr->focused_window;
while (wwin) {
if (!wwin->flags.internal_window &&
- (scr->current_workspace == wwin->frame->workspace ||
IS_OMNIPRESENT(wwin))) {
+ (wks_nfo.current_workspace == wwin->frame->workspace ||
IS_OMNIPRESENT(wwin))) {
if (wwin->flags.miniaturized) {
wwin->flags.skip_next_animation = 1;
wDeiconifyWindow(wwin);
@@ -1805,7 +1806,7 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
while (wwin) {
if (wwin->icon && wwin->flags.miniaturized &&
!wwin->flags.hidden &&
- (wwin->frame->workspace == scr->current_workspace ||
+ (wwin->frame->workspace == wks_nfo.current_workspace ||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)) {
head = wGetHeadForWindow(wwin);
@@ -1871,7 +1872,7 @@ void wSelectWindow(WWindow *wwin, Bool flag)
void wMakeWindowVisible(WWindow *wwin)
{
- if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
+ if (wwin->frame->workspace != wks_nfo.current_workspace)
wWorkspaceChange(wwin->screen_ptr, wwin->frame->workspace);
if (wwin->flags.shaded) {
diff --git a/src/appicon.c b/src/appicon.c
index 26457f2..2ad4005 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -186,7 +186,7 @@ void unpaint_app_icon(WApplication *wapp)
return;
scr = wapp->main_window_desc->screen_ptr;
- clip = scr->workspaces[scr->current_workspace]->clip;
+ clip = scr->workspaces[wks_nfo.current_workspace]->clip;
if (!clip || !aicon->attracted || !clip->collapsed)
XUnmapWindow(dpy, aicon->icon->core->window);
@@ -220,7 +220,7 @@ void paint_app_icon(WApplication *wapp)
attracting_dock = scr->attracting_drawer != NULL ?
scr->attracting_drawer :
- scr->workspaces[scr->current_workspace]->clip;
+ scr->workspaces[wks_nfo.current_workspace]->clip;
if (attracting_dock && attracting_dock->attract_icons &&
wDockFindFreeSlot(attracting_dock, &x, &y)) {
wapp->app_icon->attracted = 1;
@@ -383,14 +383,14 @@ void wAppIconMove(WAppIcon * aicon, int x, int y)
}
#ifdef WS_INDICATOR
-static void updateDockNumbers(WScreen * scr)
+static void updateDockNumbers(WScreen *scr)
{
int length;
char *ws_numbers;
WAppIcon *dicon = scr->dock->icon_array[0];
ws_numbers = wmalloc(20);
- snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace + 1,
((scr->current_workspace / 10) + 1));
+ snprintf(ws_numbers, 20, "%i [ %i ]", wks_nfo.current_workspace + 1,
((wks_nfo.current_workspace / 10) + 1));
length = strlen(ws_numbers);
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50,
WMFontHeight(scr->icon_title_font) + 1, False);
@@ -675,7 +675,7 @@ static void iconDblClick(WObjDescriptor *desc, XEvent
*event)
unhideHere = (event->xbutton.state & ShiftMask);
/* go to the last workspace that the user worked on the app */
- if (!unhideHere && wapp->last_workspace != scr->current_workspace)
+ if (!unhideHere && wapp->last_workspace != wks_nfo.current_workspace)
wWorkspaceChange(scr, wapp->last_workspace);
wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);
@@ -816,8 +816,8 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
if (!wPreferences.flags.nodock && scr->dock != originalDock)
allDocks[ i++ ] = scr->dock;
if (!wPreferences.flags.noclip &&
- originalDock != scr->workspaces[scr->current_workspace]->clip)
- allDocks[ i++ ] = scr->workspaces[scr->current_workspace]->clip;
+ originalDock != scr->workspaces[wks_nfo.current_workspace]->clip)
+ allDocks[ i++ ] =
scr->workspaces[wks_nfo.current_workspace]->clip;
for ( ; i < scr->drawer_count + 2; i++) /* In case the clip, the dock,
or both, are disabled */
allDocks[ i ] = NULL;
@@ -868,7 +868,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
if (omnipresent && !showed_all_clips) {
int i;
for (i = 0; i < wks_nfo.workspace_count; i++) {
- if (i == scr->current_workspace)
+ if (i == wks_nfo.current_workspace)
continue;
wDockShowIcons(scr->workspaces[i]->clip);
/* Note: if dock is collapsed (for
instance, because it
@@ -1073,7 +1073,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
if (showed_all_clips) {
int i;
for (i = 0; i < wks_nfo.workspace_count; i++) {
- if (i == scr->current_workspace)
+ if (i == wks_nfo.current_workspace)
continue;
wDockHideIcons(scr->workspaces[i]->clip);
}
diff --git a/src/balloon.c b/src/balloon.c
index e2c294a..b210b7c 100644
--- a/src/balloon.c
+++ b/src/balloon.c
@@ -43,6 +43,7 @@
#include "workspace.h"
#include "balloon.h"
+extern wks_info wks_nfo;
typedef struct _WBalloon {
Window window;
@@ -440,8 +441,8 @@ static void appiconBalloon(WObjDescriptor * object)
/* Show balloon if it is the Clip and the workspace name is > 5 chars */
if (object->parent == scr->clip_icon) {
- if (strlen(scr->workspaces[scr->current_workspace]->name) > 5) {
- scr->balloon->text =
wstrdup(scr->workspaces[scr->current_workspace]->name);
+ if (strlen(scr->workspaces[wks_nfo.current_workspace]->name) >
5) {
+ scr->balloon->text =
wstrdup(scr->workspaces[wks_nfo.current_workspace]->name);
} else {
wBalloonHide(scr);
return;
diff --git a/src/cycling.c b/src/cycling.c
index 4955e3f..712e31b 100644
--- a/src/cycling.c
+++ b/src/cycling.c
@@ -37,9 +37,11 @@
#include "cycling.h"
#include "xinerama.h"
#include "switchpanel.h"
+#include "workspace.h"
/* Globals */
extern WShortKey wKeyBindings[WKBD_LAST];
+extern wks_info wks_nfo;
static void raiseWindow(WSwitchPanel * swpanel, WWindow * wwin)
{
@@ -135,7 +137,7 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool
next, Bool class_onl
oldFocused = change_focus_and_raise(newFocused, oldFocused,
swpanel, scr, False);
} else {
- if (wwin->frame->workspace == scr->current_workspace)
+ if (wwin->frame->workspace == wks_nfo.current_workspace)
newFocused = wwin;
else
newFocused = NULL;
diff --git a/src/defaults.c b/src/defaults.c
index 67ca62a..1fc0064 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -2454,7 +2454,7 @@ static int setWrapAppiconsInDock(WScreen *scr,
WDefaultEntry *entry, void *tdata
static int setStickyIcons(WScreen * scr, WDefaultEntry * entry, void *bar,
void *foo)
{
if (scr->workspaces) {
- wWorkspaceForceChange(scr, scr->current_workspace);
+ wWorkspaceForceChange(scr, wks_nfo.current_workspace);
wArrangeIcons(scr, False);
}
return 0;
@@ -2884,7 +2884,7 @@ static int setWorkspaceBack(WScreen * scr, WDefaultEntry
* entry, void *tdata, v
if (str) {
SendHelperMessage(scr, 'S', 0, str);
wfree(str);
- SendHelperMessage(scr, 'C',
scr->current_workspace + 1, NULL);
+ SendHelperMessage(scr, 'C',
wks_nfo.current_workspace + 1, NULL);
} else {
SendHelperMessage(scr, 'U', 0, NULL);
}
diff --git a/src/dock.c b/src/dock.c
index 60c8910..abfde26 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -176,7 +176,7 @@ static void renameCallback(WMenu *menu, WMenuEntry *entry)
assert(entry->clientdata != NULL);
- wspace = dock->screen_ptr->current_workspace;
+ wspace = wks_nfo.current_workspace;
name = wstrdup(dock->screen_ptr->workspaces[wspace]->name);
@@ -869,7 +869,7 @@ static void switchWSCommand(WMenu *menu, WMenuEntry *entry)
WMArray *selectedIcons;
int x, y;
- if (entry->order == scr->current_workspace)
+ if (entry->order == wks_nfo.current_workspace)
return;
src = icon->dock;
dest = scr->workspaces[entry->order]->clip;
@@ -963,7 +963,7 @@ static void updateWorkspaceMenu(WMenu *menu, WAppIcon *icon)
menu->flags.realized = 0;
}
- if (i == scr->current_workspace)
+ if (i == wks_nfo.current_workspace)
wMenuSetEnabled(menu, i, False);
else
wMenuSetEnabled(menu, i, True);
@@ -1371,7 +1371,7 @@ void wDockDestroy(WDock *dock)
void wClipIconPaint(WAppIcon *aicon)
{
WScreen *scr = aicon->icon->core->screen_ptr;
- WWorkspace *workspace = scr->workspaces[scr->current_workspace];
+ WWorkspace *workspace = scr->workspaces[wks_nfo.current_workspace];
WMColor *color;
Window win = aicon->icon->core->window;
int length, nlength;
@@ -1383,7 +1383,7 @@ void wClipIconPaint(WAppIcon *aicon)
length = strlen(workspace->name);
ws_name = wmalloc(length + 1);
snprintf(ws_name, length + 1, "%s", workspace->name);
- snprintf(ws_number, sizeof(ws_number), "%i", scr->current_workspace +
1);
+ snprintf(ws_number, sizeof(ws_number), "%i", wks_nfo.current_workspace
+ 1);
nlength = strlen(ws_number);
if (wPreferences.flags.noclip || !workspace->clip->collapsed)
@@ -2033,7 +2033,7 @@ static WDock *findDock(WScreen *scr, XEvent *event, int
*icon_pos)
}
}
}
- if (*icon_pos < 0 && (dock =
scr->workspaces[scr->current_workspace]->clip) != NULL) {
+ if (*icon_pos < 0 && (dock =
scr->workspaces[wks_nfo.current_workspace]->clip) != NULL) {
for (i = 0; i < dock->max_icons; i++) {
if (dock->icon_array[i]
&& dock->icon_array[i]->icon->core->window ==
event->xclient.window) {
@@ -2580,7 +2580,7 @@ Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int
req_x, int req_y, int *ret_x
int neighbours = 0;
int start, stop, k;
- start = icon->omnipresent ? 0 : scr->current_workspace;
+ start = icon->omnipresent ? 0 : wks_nfo.current_workspace;
stop = icon->omnipresent ? wks_nfo.workspace_count : start + 1;
aicon = NULL;
@@ -2710,7 +2710,7 @@ Bool wDockFindFreeSlot(WDock *dock, int *x_pos, int
*y_pos)
return True;
}
- if (dock->type == WM_CLIP && dock !=
scr->workspaces[scr->current_workspace]->clip)
+ if (dock->type == WM_CLIP && dock !=
scr->workspaces[wks_nfo.current_workspace]->clip)
extra_count = scr->global_icon_count;
/* if the dock is full */
@@ -3067,7 +3067,7 @@ static pid_t execCommand(WAppIcon *btn, const char
*command, WSavedState *state)
if (btn->dock == scr->dock || btn->dock->type ==
WM_DRAWER || btn->omnipresent)
state->workspace = -1;
else
- state->workspace = scr->current_workspace;
+ state->workspace = wks_nfo.current_workspace;
}
wWindowAddSavedState(btn->wm_instance, btn->wm_class, cmdline,
pid, state);
wAddDeathHandler(pid, (WDeathHandler *) trackDeadProcess,
btn->dock);
@@ -3277,8 +3277,8 @@ void wClipUpdateForWorkspaceChange(WScreen *scr, int
workspace)
{
if (!wPreferences.flags.noclip) {
scr->clip_icon->dock = scr->workspaces[workspace]->clip;
- if (scr->current_workspace != workspace) {
- WDock *old_clip =
scr->workspaces[scr->current_workspace]->clip;
+ if (wks_nfo.current_workspace != workspace) {
+ WDock *old_clip =
scr->workspaces[wks_nfo.current_workspace]->clip;
WAppIconChain *chain = scr->global_icons;
while (chain) {
@@ -3597,7 +3597,7 @@ static void iconDblClick(WObjDescriptor *desc, XEvent
*event)
unhideHere = (event->xbutton.state & ShiftMask);
/* go to the last workspace that the user worked on the app */
- if (wapp->last_workspace != dock->screen_ptr->current_workspace
&& !unhideHere)
+ if (wapp->last_workspace != wks_nfo.current_workspace &&
!unhideHere)
wWorkspaceChange(dock->screen_ptr,
wapp->last_workspace);
wUnhideApplication(wapp, event->xbutton.button == Button2,
unhideHere);
@@ -3900,16 +3900,16 @@ static void handleClipChangeWorkspace(WScreen *scr,
XEvent *event)
new_ws = wPreferences.ws_advance || (event->xbutton.state &
ControlMask);
if (direction == CLIP_FORWARD) {
- if (scr->current_workspace < wks_nfo.workspace_count - 1)
- wWorkspaceChange(scr, scr->current_workspace + 1);
- else if (new_ws && scr->current_workspace < MAX_WORKSPACES - 1)
- wWorkspaceChange(scr, scr->current_workspace + 1);
+ if (wks_nfo.current_workspace < wks_nfo.workspace_count - 1)
+ wWorkspaceChange(scr, wks_nfo.current_workspace + 1);
+ else if (new_ws && wks_nfo.current_workspace < MAX_WORKSPACES -
1)
+ wWorkspaceChange(scr, wks_nfo.current_workspace + 1);
else if (wPreferences.ws_cycle)
wWorkspaceChange(scr, 0);
} else if (direction == CLIP_REWIND) {
- if (scr->current_workspace > 0)
- wWorkspaceChange(scr, scr->current_workspace - 1);
- else if (scr->current_workspace == 0 && wPreferences.ws_cycle)
+ if (wks_nfo.current_workspace > 0)
+ wWorkspaceChange(scr, wks_nfo.current_workspace - 1);
+ else if (wks_nfo.current_workspace == 0 &&
wPreferences.ws_cycle)
wWorkspaceChange(scr, wks_nfo.workspace_count - 1);
}
diff --git a/src/event.c b/src/event.c
index 2c03a08..98ad609 100644
--- a/src/event.c
+++ b/src/event.c
@@ -865,7 +865,7 @@ static void handleUnmapNotify(XEvent * event)
return;
if (!wwin->flags.mapped && !withdraw
- && wwin->frame->workspace == wwin->screen_ptr->current_workspace
+ && wwin->frame->workspace == wks_nfo.current_workspace
&& !wwin->flags.miniaturized && !wwin->flags.hidden)
return;
@@ -1585,7 +1585,7 @@ static void handleKeyPress(XEvent * event)
case WKBD_WORKSPACE1 ... WKBD_WORKSPACE10:
widx = command - WKBD_WORKSPACE1;
- i = (scr->current_workspace / 10) * 10 + widx;
+ i = (wks_nfo.current_workspace / 10) * 10 + widx;
if (wPreferences.ws_advance || i < wks_nfo.workspace_count)
wWorkspaceChange(scr, i);
break;
@@ -1602,7 +1602,7 @@ static void handleKeyPress(XEvent * event)
case WKBD_MOVE_WORKSPACE1 ... WKBD_MOVE_WORKSPACE10:
widx = command - WKBD_MOVE_WORKSPACE1;
- i = (scr->current_workspace / 10) * 10 + widx;
+ i = (wks_nfo.current_workspace / 10) * 10 + widx;
if (wwin && (wPreferences.ws_advance || i <
wks_nfo.workspace_count))
wWindowChangeWorkspace(wwin, i);
break;
@@ -1626,8 +1626,8 @@ static void handleKeyPress(XEvent * event)
if (wwin) {
int row, column;
- row = scr->current_workspace / 10;
- column = scr->current_workspace % 10;
+ row = wks_nfo.current_workspace / 10;
+ column = wks_nfo.current_workspace % 10;
if (command == WKBD_MOVE_NEXTWSLAYER) {
if ((row + 1) * 10 <
wks_nfo.workspace_count)
@@ -1662,7 +1662,7 @@ static void handleKeyPress(XEvent * event)
WWindow *wwin;
wUnselectWindows(scr);
- cw = scr->current_workspace;
+ cw = wks_nfo.current_workspace;
WM_ETARETI_ARRAY(list, wwin, iter) {
if (count > 1)
@@ -1746,8 +1746,8 @@ static void handleKeyPress(XEvent * event)
{
int row, column;
- row = scr->current_workspace / 10;
- column = scr->current_workspace % 10;
+ row = wks_nfo.current_workspace / 10;
+ column = wks_nfo.current_workspace % 10;
if (command == WKBD_NEXTWSLAYER) {
if ((row + 1) * 10 < wks_nfo.workspace_count)
@@ -1760,7 +1760,7 @@ static void handleKeyPress(XEvent * event)
break;
case WKBD_CLIPRAISELOWER:
if (!wPreferences.flags.noclip)
-
wDockRaiseLower(scr->workspaces[scr->current_workspace]->clip);
+
wDockRaiseLower(scr->workspaces[wks_nfo.current_workspace]->clip);
break;
case WKBD_DOCKRAISELOWER:
if (!wPreferences.flags.nodock)
@@ -1773,7 +1773,7 @@ static void handleKeyPress(XEvent * event)
wwin = scr->focused_window;
if (wwin && wwin->flags.mapped
- && wwin->frame->workspace ==
wwin->screen_ptr->current_workspace
+ && wwin->frame->workspace ==
wks_nfo.current_workspace
&& !wwin->flags.miniaturized &&
!wwin->flags.hidden) {
XkbGetState(dpy, XkbUseCoreKbd, &staterec);
diff --git a/src/misc.c b/src/misc.c
index 27a6ab2..7d50e3f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -49,10 +49,12 @@
#include "dialog.h"
#include "xutil.h"
#include "xmodifier.h"
-
+#include "workspace.h"
#define ICON_SIZE wPreferences.icon_size
+extern wks_info wks_nfo;
+
/**** Local prototypes *****/
static void UnescapeWM_CLASS(const char *str, char **name, char **class);
@@ -587,7 +589,7 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
break;
case 'W':
- snprintf(tmpbuf, sizeof(tmpbuf), "0x%x",
(unsigned int)scr->current_workspace + 1);
+ snprintf(tmpbuf, sizeof(tmpbuf), "0x%x",
(unsigned int)wks_nfo.current_workspace + 1);
slen = strlen(tmpbuf);
olen += slen;
nout = realloc(out, olen);
diff --git a/src/moveres.c b/src/moveres.c
index b0026b5..768864d 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -745,7 +745,7 @@ static void updateMoveData(WWindow * wwin, MoveData * data)
data->count = 0;
tmp = scr->focused_window;
while (tmp) {
- if (tmp != wwin && scr->current_workspace ==
tmp->frame->workspace
+ if (tmp != wwin && wks_nfo.current_workspace ==
tmp->frame->workspace
&& !tmp->flags.miniaturized
&& !tmp->flags.hidden && !tmp->flags.obscured &&
!WFLAGP(tmp, sunken)) {
data->topList[data->count] = tmp;
@@ -840,13 +840,13 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData
* data, Bool opaqueMov
Bool changed = False;
if (data->mouseX <= 1) {
- if (scr->current_workspace > 0) {
+ if (wks_nfo.current_workspace > 0) {
- crossWorkspace(scr, wwin, opaqueMove,
scr->current_workspace - 1, True);
+ crossWorkspace(scr, wwin, opaqueMove,
wks_nfo.current_workspace - 1, True);
changed = True;
data->rubCount = 0;
- } else if (scr->current_workspace == 0 &&
wPreferences.ws_cycle) {
+ } else if (wks_nfo.current_workspace == 0 &&
wPreferences.ws_cycle) {
crossWorkspace(scr, wwin, opaqueMove,
wks_nfo.workspace_count - 1, True);
changed = True;
@@ -854,7 +854,7 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData *
data, Bool opaqueMov
}
} else if (data->mouseX >= scr->scr_width - 2) {
- if (scr->current_workspace == wks_nfo.workspace_count - 1) {
+ if (wks_nfo.current_workspace == wks_nfo.workspace_count - 1) {
if (wPreferences.ws_cycle || wks_nfo.workspace_count ==
MAX_WORKSPACES) {
@@ -881,14 +881,14 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData
* data, Bool opaqueMov
/* go to next workspace */
wWorkspaceNew(scr);
- crossWorkspace(scr, wwin, opaqueMove,
scr->current_workspace + 1, False);
+ crossWorkspace(scr, wwin, opaqueMove,
wks_nfo.current_workspace + 1, False);
changed = True;
data->rubCount = 0;
}
- } else if (scr->current_workspace < wks_nfo.workspace_count) {
+ } else if (wks_nfo.current_workspace < wks_nfo.workspace_count)
{
/* go to next workspace */
- crossWorkspace(scr, wwin, opaqueMove,
scr->current_workspace + 1, False);
+ crossWorkspace(scr, wwin, opaqueMove,
wks_nfo.current_workspace + 1, False);
changed = True;
data->rubCount = 0;
}
@@ -1397,17 +1397,17 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
if (wPreferences.ws_cycle) {
if (src_x + off_x + ww < 20) {
- if (!scr->current_workspace) {
+ if (!wks_nfo.current_workspace)
{
wWorkspaceChange(scr,
wks_nfo.workspace_count - 1);
} else {
- wWorkspaceChange(scr,
scr->current_workspace - 1);
+ wWorkspaceChange(scr,
wks_nfo.current_workspace - 1);
}
off_x += scr_width;
} else if (src_x + off_x + 20 >
scr_width) {
- if (scr->current_workspace ==
wks_nfo.workspace_count - 1) {
+ if (wks_nfo.current_workspace
== wks_nfo.workspace_count - 1) {
wWorkspaceChange(scr,
0);
} else {
- wWorkspaceChange(scr,
scr->current_workspace + 1);
+ wWorkspaceChange(scr,
wks_nfo.current_workspace + 1);
}
off_x -= scr_width;
}
@@ -1530,7 +1530,7 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
wWindowConfigure(wwin, src_x + off_x,
src_y + off_y, ww, wh - vert_border);
wWindowSynthConfigureNotify(wwin);
}
- wWindowChangeWorkspace(wwin,
scr->current_workspace);
+ wWindowChangeWorkspace(wwin,
wks_nfo.current_workspace);
wSetFocusTo(scr, wwin);
}
@@ -1663,7 +1663,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
opaqueMove,
event.xmotion.x_root, event.xmotion.y_root);
if (!warped && !wPreferences.no_autowrap) {
- int oldWorkspace =
scr->current_workspace;
+ int oldWorkspace =
wks_nfo.current_workspace;
if (wPreferences.move_display ==
WDIS_NEW && !scr->selected_windows) {
showPosition(wwin,
moveData.realX, moveData.realY);
@@ -1675,7 +1675,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
moveData.realY -
wwin->frame_y);
}
if (checkWorkspaceChange(wwin,
&moveData, opaqueMove)) {
- if (scr->current_workspace !=
oldWorkspace
+ if (wks_nfo.current_workspace
!= oldWorkspace
&&
wPreferences.edge_resistance > 0
&& scr->selected_windows ==
NULL)
updateMoveData(wwin,
&moveData);
@@ -1742,7 +1742,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
XUngrabKeyboard(dpy, CurrentTime);
XUngrabServer(dpy);
if (!opaqueMove) {
- wWindowChangeWorkspace(wwin,
scr->current_workspace);
+ wWindowChangeWorkspace(wwin,
wks_nfo.current_workspace);
wSetFocusTo(scr, wwin);
}
if (wPreferences.move_display == WDIS_NEW)
@@ -2133,7 +2133,7 @@ static void selectWindowsInside(WScreen * scr, int x1,
int y1, int x2, int y2)
tmpw = scr->focused_window;
while (tmpw != NULL) {
if (!(tmpw->flags.miniaturized || tmpw->flags.hidden)) {
- if ((tmpw->frame->workspace == scr->current_workspace
|| IS_OMNIPRESENT(tmpw))
+ if ((tmpw->frame->workspace ==
wks_nfo.current_workspace || IS_OMNIPRESENT(tmpw))
&& (tmpw->frame_x >= x1) && (tmpw->frame_y >= y1)
&& (tmpw->frame->core->width + tmpw->frame_x <= x2)
&& (tmpw->frame->core->height + tmpw->frame_y <=
y2)) {
diff --git a/src/placement.c b/src/placement.c
index 59f137d..a9d2d1a 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -38,7 +38,7 @@
#include "dock.h"
#include "xinerama.h"
#include "placement.h"
-
+#include "workspace.h"
#define X_ORIGIN WMAX(usableArea.x1,\
wPreferences.window_place_origin.x)
@@ -46,6 +46,8 @@
#define Y_ORIGIN WMAX(usableArea.y1,\
wPreferences.window_place_origin.y)
+extern wks_info wks_nfo;
+
/* Returns True if it is an icon and is in this workspace */
static Bool
iconPosition(WCoreWindow *wcore, int sx1, int sy1, int sx2, int sy2,
@@ -172,7 +174,7 @@ void PlaceIcon(WScreen *scr, int *x_ret, int *y_ret, int
head)
while (obj) {
int x, y;
- if (iconPosition(obj, sx1, sy1, sx2, sy2,
scr->current_workspace, &x, &y)) {
+ if (iconPosition(obj, sx1, sy1, sx2, sy2,
wks_nfo.current_workspace, &x, &y)) {
int xdi, ydi; /* rounded down */
int xui, yui; /* rounded up */
@@ -269,7 +271,7 @@ static int calcSumOfCoveredAreas(WWindow *wwin, int x, int
y, int w, int h)
ty = test_window->frame_y;
if (test_window->flags.mapped || (test_window->flags.shaded &&
- test_window->frame->workspace ==
wwin->screen_ptr->current_workspace &&
+ test_window->frame->workspace == wks_nfo.current_workspace
&&
!(test_window->flags.miniaturized ||
test_window->flags.hidden))) {
sum_isect += calcIntersectionArea(tx, ty, tw, th, x, y,
w, h);
}
@@ -413,7 +415,7 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
(ty < (test_y + height)) && ((ty + th) >
test_y) &&
(test_window->flags.mapped ||
(test_window->flags.shaded &&
- test_window->frame->workspace ==
scr->current_workspace &&
+ test_window->frame->workspace ==
wks_nfo.current_workspace &&
!(test_window->flags.miniaturized ||
test_window->flags.hidden)))) {
loc_ok = False;
@@ -439,7 +441,7 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
(ty < (test_y + height)) && ((ty + th) >
test_y) &&
(test_window->flags.mapped ||
(test_window->flags.shaded &&
- test_window->frame->workspace ==
scr->current_workspace &&
+ test_window->frame->workspace ==
wks_nfo.current_workspace &&
!(test_window->flags.miniaturized ||
test_window->flags.hidden)))) {
loc_ok = False;
diff --git a/src/screen.h b/src/screen.h
index dd13d6c..f08a6cb 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -123,8 +123,6 @@ typedef struct _WScreen {
struct WWorkspace **workspaces; /* workspace array */
- int current_workspace; /* current workspace number */
-
WReservedArea *reservedAreas; /* used to build totalUsableArea */
WArea *usableArea; /* area of the workspace where
diff --git a/src/session.c b/src/session.c
index 131339f..70eb10d 100644
--- a/src/session.c
+++ b/src/session.c
@@ -324,7 +324,7 @@ void wSessionSaveState(WScreen * scr)
WMPutInPLDictionary(scr->session_state, sApplications, list);
WMReleasePropList(list);
- wks = WMCreatePLString(scr->workspaces[scr->current_workspace]->name);
+ wks =
WMCreatePLString(scr->workspaces[wks_nfo.current_workspace]->name);
WMPutInPLDictionary(scr->session_state, sWorkspace, wks);
WMReleasePropList(wks);
@@ -564,6 +564,6 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
/* Get the workspace number for the workspace name */
w = wGetWorkspaceNumber(scr, value);
- if (w != scr->current_workspace && w < wks_nfo.workspace_count)
+ if (w != wks_nfo.current_workspace && w < wks_nfo.workspace_count)
wWorkspaceChange(scr, w);
}
diff --git a/src/startup.c b/src/startup.c
index 46ee752..b2190ba 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -910,6 +910,6 @@ static void manageAllWindows(WScreen * scr, int
crashRecovery)
wks_nfo.last_used_workspace = 0;
wWorkspaceForceChange(scr, 0);
if (!wPreferences.flags.noclip)
- wDockShowIcons(scr->workspaces[scr->current_workspace]->clip);
+
wDockShowIcons(scr->workspaces[wks_nfo.current_workspace]->clip);
scr->flags.startup2 = 0;
}
diff --git a/src/switchpanel.c b/src/switchpanel.c
index f305d41..29d8ee7 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -34,8 +34,10 @@
#include "switchpanel.h"
#include "misc.h"
#include "xinerama.h"
+#include "workspace.h"
extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
+extern wks_info wks_nfo;
#ifdef SHAPE
#include <X11/extensions/shape.h>
@@ -78,7 +80,7 @@ struct SwitchPanel {
static int canReceiveFocus(WWindow *wwin)
{
- if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
+ if (wwin->frame->workspace != wks_nfo.current_workspace)
return 0;
if (wPreferences.cycle_active_head_only &&
diff --git a/src/window.c b/src/window.c
index 443182d..7c9a4dc 100644
--- a/src/window.c
+++ b/src/window.c
@@ -855,12 +855,12 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (w < 0 || w >= wks_nfo.workspace_count) {
workspace = win_state->state->workspace;
if (workspace >= wks_nfo.workspace_count)
- workspace = scr->current_workspace;
+ workspace = wks_nfo.current_workspace;
} else {
workspace = w;
}
} else {
- workspace = scr->current_workspace;
+ workspace = wks_nfo.current_workspace;
}
}
@@ -936,7 +936,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
if (wPreferences.open_transients_with_parent &&
transientOwner)
workspace = transientOwner->frame->workspace;
else
- workspace = scr->current_workspace;
+ workspace = wks_nfo.current_workspace;
}
}
@@ -960,7 +960,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
y = win_state->state->y;
} else if ((wwin->transient_for == None ||
wPreferences.window_placement != WPM_MANUAL)
&& !scr->flags.startup
- && workspace == scr->current_workspace
+ && workspace == wks_nfo.current_workspace
&& !wwin->flags.miniaturized
&& !wwin->flags.maximized &&
!(wwin->normal_hints->flags & (USPosition | PPosition))) {
@@ -1199,7 +1199,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
XLowerWindow(dpy, window);
/* if window is in this workspace and should be mapped, then map it */
- if (!wwin->flags.miniaturized && (workspace == scr->current_workspace
|| IS_OMNIPRESENT(wwin))
+ if (!wwin->flags.miniaturized && (workspace ==
wks_nfo.current_workspace || IS_OMNIPRESENT(wwin))
&& !wwin->flags.hidden && !withdraw) {
/* The following "if" is to avoid crashing of clients that
expect
@@ -1273,7 +1273,7 @@ WWindow *wManageWindow(WScreen *scr, Window window)
/* Final preparations before window is ready to go */
wFrameWindowChangeState(wwin->frame, WS_UNFOCUSED);
- if (!wwin->flags.miniaturized && workspace == scr->current_workspace &&
!wwin->flags.hidden) {
+ if (!wwin->flags.miniaturized && workspace == wks_nfo.current_workspace
&& !wwin->flags.hidden) {
if (((transientOwner && transientOwner->flags.focused)
|| wPreferences.auto_focus) && !WFLAGP(wwin,
no_focusable)) {
@@ -1382,7 +1382,7 @@ WWindow *wManageInternalWindow(WScreen *scr, Window
window, Window owner,
wFrameWindowHideButton(wwin->frame, WFF_RIGHT_BUTTON);
wwin->frame->child = wwin;
- wwin->frame->workspace = wwin->screen_ptr->current_workspace;
+ wwin->frame->workspace = wks_nfo.current_workspace;
#ifdef XKB_BUTTON_HINT
if (wPreferences.modelock)
@@ -1880,7 +1880,7 @@ void wWindowChangeWorkspace(WWindow *wwin, int workspace)
if (workspace >= wks_nfo.workspace_count || workspace < 0 || workspace
== wwin->frame->workspace)
return;
- if (workspace != scr->current_workspace) {
+ if (workspace != wks_nfo.current_workspace) {
/* Sent to other workspace. Unmap window */
if ((wwin->flags.mapped
|| wwin->flags.shaded || (wwin->flags.miniaturized &&
!wPreferences.sticky_icons))
@@ -1924,7 +1924,7 @@ void wWindowChangeWorkspace(WWindow *wwin, int workspace)
void wWindowChangeWorkspaceRelative(WWindow *wwin, int amount)
{
WScreen *scr = wwin->screen_ptr;
- int w = scr->current_workspace + amount;
+ int w = wks_nfo.current_workspace + amount;
if (amount < 0) {
if (w >= 0) {
diff --git a/src/winmenu.c b/src/winmenu.c
index fa232e4..7f93a3d 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -246,7 +246,7 @@ static void updateWorkspaceMenu(WMenu * menu)
}
/* workspace shortcut labels */
- if (i / 10 == scr->current_workspace / 10)
+ if (i / 10 == wks_nfo.current_workspace / 10)
entry->rtext =
GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + (i % 10)]);
else
entry->rtext = NULL;
@@ -573,11 +573,10 @@ static void updateMenuForWindow(WMenu * menu, WWindow *
wwin)
for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
scr->workspace_submenu->entries[i]->clientdata = wwin;
- if (i == scr->current_workspace) {
+ if (i == wks_nfo.current_workspace)
wMenuSetEnabled(scr->workspace_submenu, i, False);
- } else {
+ else
wMenuSetEnabled(scr->workspace_submenu, i, True);
- }
}
menu->flags.realized = 0;
diff --git a/src/wmspec.c b/src/wmspec.c
index b19175f..4df1d81 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -513,13 +513,13 @@ static void wNETWMShowingDesktop(WScreen *scr, Bool show)
updateShowDesktop(scr, True);
} else if (scr->netdata->show_desktop != NULL) {
/* FIXME: get rid of workspace flashing ! */
- int ws = scr->current_workspace;
+ int ws = wks_nfo.current_workspace;
WWindow **tmp;
for (tmp = scr->netdata->show_desktop; *tmp; ++tmp) {
wDeiconifyWindow(*tmp);
(*tmp)->flags.net_show_desktop = 0;
}
- if (ws != scr->current_workspace)
+ if (ws != wks_nfo.current_workspace)
wWorkspaceChange(scr, ws);
wfree(scr->netdata->show_desktop);
scr->netdata->show_desktop = NULL;
@@ -750,7 +750,7 @@ static void updateCurrentWorkspace(WScreen *scr)
{ /* changeable */
long count;
- count = scr->current_workspace;
+ count = wks_nfo.current_workspace;
XChangeProperty(dpy, scr->root_win, net_current_desktop, XA_CARDINAL,
32,
PropModeReplace, (unsigned char *)&count, 1);
@@ -1398,7 +1398,7 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent
*event)
* - giving the client the focus does not cause a change in
* the active workspace (XXX: or the active head if Xinerama)
*/
- if (wwin->frame->workspace ==
wwin->screen_ptr->current_workspace /* No workspace change */
+ if (wwin->frame->workspace == wks_nfo.current_workspace /* No
workspace change */
|| event->data.l[0] == 2 /* Requested by pager */
|| WFLAGP(wwin, focus_across_wksp) /* Explicitly allowed
*/) {
wNETWMShowingDesktop(scr, False);
diff --git a/src/workspace.c b/src/workspace.c
index b731d22..c5c2526 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -192,7 +192,7 @@ Bool wWorkspaceDelete(WScreen * scr, int workspace)
wNETWMUpdateDesktop(scr);
WMPostNotificationName(WMNWorkspaceDestroyed, scr, (void *)(uintptr_t)
(wks_nfo.workspace_count - 1));
- if (scr->current_workspace >= wks_nfo.workspace_count)
+ if (wks_nfo.current_workspace >= wks_nfo.workspace_count)
wWorkspaceChange(scr, wks_nfo.workspace_count - 1);
if (wks_nfo.last_used_workspace >= wks_nfo.workspace_count)
wks_nfo.last_used_workspace = 0;
@@ -434,7 +434,7 @@ void wWorkspaceChange(WScreen *scr, int workspace)
if (scr->flags.startup || scr->flags.startup2 ||
scr->flags.ignore_focus_events)
return;
- if (workspace != scr->current_workspace)
+ if (workspace != wks_nfo.current_workspace)
wWorkspaceForceChange(scr, workspace);
}
@@ -449,7 +449,7 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount)
if (ignore_wks_change)
return;
- w = scr->current_workspace + amount;
+ w = wks_nfo.current_workspace + amount;
if (amount < 0) {
if (w >= 0) {
@@ -485,8 +485,8 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
wClipUpdateForWorkspaceChange(scr, workspace);
- wks_nfo.last_used_workspace = scr->current_workspace;
- scr->current_workspace = workspace;
+ wks_nfo.last_used_workspace = wks_nfo.current_workspace;
+ wks_nfo.current_workspace = workspace;
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
@@ -777,25 +777,24 @@ void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
for (i = 0; i < wks_nfo.workspace_count; i++) {
/* workspace shortcut labels */
- if (i / 10 == scr->current_workspace / 10)
+ if (i / 10 == wks_nfo.current_workspace / 10)
menu->entries[i + MC_WORKSPACE1]->rtext =
GetShortcutKey(wKeyBindings[WKBD_WORKSPACE1 + (i % 10)]);
else
menu->entries[i + MC_WORKSPACE1]->rtext = NULL;
menu->entries[i + MC_WORKSPACE1]->flags.indicator_on = 0;
}
- menu->entries[scr->current_workspace +
MC_WORKSPACE1]->flags.indicator_on = 1;
+ menu->entries[wks_nfo.current_workspace +
MC_WORKSPACE1]->flags.indicator_on = 1;
wMenuRealize(menu);
/* don't let user destroy current workspace */
- if (scr->current_workspace == wks_nfo.workspace_count - 1) {
+ if (wks_nfo.current_workspace == wks_nfo.workspace_count - 1)
wMenuSetEnabled(menu, MC_DESTROY_LAST, False);
- } else {
+ else
wMenuSetEnabled(menu, MC_DESTROY_LAST, True);
- }
/* back to last workspace */
- if (wks_nfo.workspace_count && wks_nfo.last_used_workspace !=
scr->current_workspace)
+ if (wks_nfo.workspace_count && wks_nfo.last_used_workspace !=
wks_nfo.current_workspace)
wMenuSetEnabled(menu, MC_LAST_USED, True);
else
wMenuSetEnabled(menu, MC_LAST_USED, False);
diff --git a/src/workspace.h b/src/workspace.h
index 18492cb..e77c661 100644
--- a/src/workspace.h
+++ b/src/workspace.h
@@ -24,6 +24,7 @@
typedef struct wks_info {
int workspace_count; /* number of workspaces */
+ int current_workspace; /* current workspace number */
int last_used_workspace; /* last used workspace number */
WMFont *workspace_name_font;
} wks_info;
diff --git a/src/xdnd.c b/src/xdnd.c
index 5230da5..138d143 100644
--- a/src/xdnd.c
+++ b/src/xdnd.c
@@ -213,7 +213,7 @@ Bool acceptXDND(Window window)
}
}
}
- if (icon_pos < 0 && (dock =
scr->workspaces[scr->current_workspace]->clip) != NULL) {
+ if (icon_pos < 0 && (dock =
scr->workspaces[wks_nfo.current_workspace]->clip) != NULL) {
for (i = 0; i < dock->max_icons; i++) {
if (dock->icon_array[i]
&& dock->icon_array[i]->icon->core->window ==
window) {
--
1.7.10.4
--
To unsubscribe, send mail to [email protected].