mirror of
https://github.com/gryf/wmaker.git
synced 2026-04-20 15:21:27 +02:00
wmaker: Restore multi screen functionality by reverting wrong commits
Revert patches that moved variables from WMScreen to global level because this broke X displays with multiple independent screens and caused dock and clip icons to become mixed up. When managing multiple screens each screen used to have it's own state/dock and clip. This commit restores that by reverting mainly the commits listed below (and those that are invalidated by reverting these) and fixing up later commits to apply after the revert. Reverted commits:f60e65001bMoved 'workspace_name_font' from the Screen to a Workspace object in the global namespace9e103a46e9Variable workspace_count moved to the workspace object in the global namespacee5ae684d02Variable last_workspace moved to workspace object in global namespacec610b8d7ceVariable current_workspace moved to workspace object in global namespacef0c5073600Array of workspaces moved to the workspace object in the global namespace9c252988f8Variable workspace_menu moved to workspace object in global namespacee86b8dcb2fClip, Dock and Drawers menu moved to appropriate global namespace074092f319Removed WScreen args not used4a7daf2322AppIcon list moved out of WScreen2103fe390bVariable clip_icon moved to clip object in the global namespace014bc52531wClipIconPaint appicon argument removed40e1ea08b8Varible session_state moved to global namespace6987d4aa40Removed WScreen argument0de3e590ceshortcutWindows moved to w_global2e64831fb6Removed unused variable wapp_listb6423a7b4fwmaker: Moved variable Screen Count into the global namespace Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
committed by
Carlos R. Mafra
parent
e3dcadde30
commit
cb3702559a
+1
-41
@@ -511,43 +511,12 @@ extern struct wmaker_global_variables {
|
||||
/* Screens related */
|
||||
int screen_count;
|
||||
|
||||
/* Workspace related */
|
||||
struct {
|
||||
struct WWorkspace **array; /* data for the workspaces */
|
||||
|
||||
int count; /* number of workspaces */
|
||||
int current; /* current workspace number */
|
||||
int last_used; /* last used workspace number */
|
||||
|
||||
WMFont *font_for_name; /* used during workspace switch */
|
||||
|
||||
/*
|
||||
* Ignore Workspace Change:
|
||||
* this variable is used to prevent workspace switch while certain
|
||||
* operations are ongoing.
|
||||
*/
|
||||
Bool ignore_change;
|
||||
|
||||
/* Menus */
|
||||
struct WMenu *menu; /* workspace operation */
|
||||
struct WMenu *submenu; /* workspace list for window_menu */
|
||||
} workspace;
|
||||
|
||||
/* Clip related */
|
||||
struct {
|
||||
struct WAppIcon *icon; /* The clip main icon, or the dock's, if they are merged */
|
||||
|
||||
struct WMenu *menu; /* Menu for clips */
|
||||
struct WMenu *submenu; /* Workspace list for clips */
|
||||
struct WMenu *opt_menu; /* Options for Clip */
|
||||
struct WMenu *ws_menu; /* workspace menu for clip */
|
||||
} clip;
|
||||
|
||||
/* Dock related */
|
||||
struct {
|
||||
struct WMenu *pos_menu; /* menu for position of the dock */
|
||||
struct WMenu *drawer_menu; /* menu for the drawers */
|
||||
} dock;
|
||||
Bool ignore_workspace_change;
|
||||
|
||||
#ifdef HAVE_INOTIFY
|
||||
struct {
|
||||
@@ -635,9 +604,6 @@ extern struct wmaker_global_variables {
|
||||
int dummy;
|
||||
} xext;
|
||||
|
||||
/* Session related */
|
||||
WMPropList *session_state;
|
||||
|
||||
/* Keyboard and shortcuts */
|
||||
struct {
|
||||
/*
|
||||
@@ -645,13 +611,7 @@ extern struct wmaker_global_variables {
|
||||
* impact the shortcuts (typically: CapsLock, NumLock, ScrollLock)
|
||||
*/
|
||||
unsigned int modifiers_mask;
|
||||
|
||||
WMArray *windows[MAX_WINDOW_SHORTCUTS];
|
||||
} shortcut;
|
||||
|
||||
/* Application related */
|
||||
struct WAppIcon *app_icon_list; /* list of all aplication icons */
|
||||
|
||||
} w_global;
|
||||
|
||||
/****** Notifications ******/
|
||||
|
||||
+28
-28
@@ -611,8 +611,8 @@ 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 != w_global.workspace.current ||
|
||||
tmp->prev->flags.miniaturized || tmp->prev->flags.hidden) {
|
||||
if (tmp->prev->frame->workspace != wwin->screen_ptr->current_workspace
|
||||
|| tmp->prev->flags.miniaturized || tmp->prev->flags.hidden) {
|
||||
tmp = tmp->prev;
|
||||
continue;
|
||||
}
|
||||
@@ -638,8 +638,8 @@ static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, i
|
||||
|
||||
tmp = wwin;
|
||||
while (tmp->prev) {
|
||||
if (tmp->prev->frame->workspace != w_global.workspace.current ||
|
||||
tmp->prev->flags.miniaturized || tmp->prev->flags.hidden) {
|
||||
if (tmp->prev->frame->workspace != wwin->screen_ptr->current_workspace
|
||||
|| tmp->prev->flags.miniaturized || tmp->prev->flags.hidden) {
|
||||
tmp = tmp->prev;
|
||||
continue;
|
||||
}
|
||||
@@ -1105,7 +1105,7 @@ void wIconifyWindow(WWindow *wwin)
|
||||
return;
|
||||
}
|
||||
|
||||
present = wwin->frame->workspace == w_global.workspace.current;
|
||||
present = wwin->frame->workspace == wwin->screen_ptr->current_workspace;
|
||||
|
||||
/* if the window is in another workspace, simplify process */
|
||||
if (present) {
|
||||
@@ -1189,7 +1189,7 @@ void wIconifyWindow(WWindow *wwin)
|
||||
wwin->flags.skip_next_animation = 0;
|
||||
|
||||
if (!wPreferences.disable_miniwindows && !wwin->flags.net_handle_icon) {
|
||||
if (w_global.workspace.current == wwin->frame->workspace ||
|
||||
if (wwin->screen_ptr->current_workspace == wwin->frame->workspace ||
|
||||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)
|
||||
XMapWindow(dpy, wwin->icon->core->window);
|
||||
|
||||
@@ -1251,17 +1251,17 @@ void wIconifyWindow(WWindow *wwin)
|
||||
void wDeiconifyWindow(WWindow *wwin)
|
||||
{
|
||||
/* Let's avoid changing workspace while deiconifying */
|
||||
w_global.workspace.ignore_change = True;
|
||||
w_global.ignore_workspace_change = True;
|
||||
|
||||
/* we're hiding for show_desktop */
|
||||
int netwm_hidden = wwin->flags.net_show_desktop &&
|
||||
wwin->frame->workspace != w_global.workspace.current;
|
||||
wwin->frame->workspace != wwin->screen_ptr->current_workspace;
|
||||
|
||||
if (!netwm_hidden)
|
||||
wWindowChangeWorkspace(wwin, w_global.workspace.current);
|
||||
wWindowChangeWorkspace(wwin, wwin->screen_ptr->current_workspace);
|
||||
|
||||
if (!wwin->flags.miniaturized) {
|
||||
w_global.workspace.ignore_change = False;
|
||||
w_global.ignore_workspace_change = False;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1272,7 +1272,7 @@ void wDeiconifyWindow(WWindow *wwin)
|
||||
wDeiconifyWindow(owner);
|
||||
wSetFocusTo(wwin->screen_ptr, wwin);
|
||||
wRaiseFrame(wwin->frame->core);
|
||||
w_global.workspace.ignore_change = False;
|
||||
w_global.ignore_workspace_change = False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1339,7 +1339,7 @@ void wDeiconifyWindow(WWindow *wwin)
|
||||
|
||||
/* the window can disappear while ProcessPendingEvents() runs */
|
||||
if (!wWindowFor(clientwin)) {
|
||||
w_global.workspace.ignore_change = False;
|
||||
w_global.ignore_workspace_change = False;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1355,7 +1355,7 @@ void wDeiconifyWindow(WWindow *wwin)
|
||||
if (!netwm_hidden)
|
||||
wUnshadeWindow(wwin);
|
||||
|
||||
w_global.workspace.ignore_change = False;
|
||||
w_global.ignore_workspace_change = False;
|
||||
}
|
||||
|
||||
static void hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate)
|
||||
@@ -1428,7 +1428,7 @@ void wHideAll(WScreen *scr)
|
||||
|
||||
for (i = 0; i < wcount; i++) {
|
||||
wwin = windows[i];
|
||||
if (wwin->frame->workspace == w_global.workspace.current
|
||||
if (wwin->frame->workspace == scr->current_workspace
|
||||
&& !(wwin->flags.miniaturized || wwin->flags.hidden)
|
||||
&& !wwin->flags.internal_window
|
||||
&& !WFLAGP(wwin, no_miniaturizable)
|
||||
@@ -1452,7 +1452,7 @@ void wHideOtherApplications(WWindow *awin)
|
||||
|
||||
while (wwin) {
|
||||
if (wwin != awin
|
||||
&& wwin->frame->workspace == w_global.workspace.current
|
||||
&& wwin->frame->workspace == awin->screen_ptr->current_workspace
|
||||
&& !(wwin->flags.miniaturized || wwin->flags.hidden)
|
||||
&& !wwin->flags.internal_window
|
||||
&& wGetWindowOfInspectorForWindow(wwin) != awin && !WFLAGP(wwin, no_hide_others)) {
|
||||
@@ -1554,7 +1554,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, w_global.workspace.current);
|
||||
wWindowChangeWorkspace(wwin, wwin->screen_ptr->current_workspace);
|
||||
|
||||
wwin->flags.hidden = 0;
|
||||
|
||||
@@ -1567,7 +1567,7 @@ static void unhideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int
|
||||
}
|
||||
#endif
|
||||
wwin->flags.skip_next_animation = 0;
|
||||
if (w_global.workspace.current == wwin->frame->workspace) {
|
||||
if (wwin->screen_ptr->current_workspace == wwin->frame->workspace) {
|
||||
XMapWindow(dpy, wwin->client_win);
|
||||
XMapWindow(dpy, wwin->frame->core->window);
|
||||
wClientSetState(wwin, NormalState, None);
|
||||
@@ -1612,7 +1612,7 @@ void wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurren
|
||||
|
||||
if (wlist->flags.miniaturized) {
|
||||
if ((bringToCurrentWS || wPreferences.sticky_icons ||
|
||||
wlist->frame->workspace == w_global.workspace.current) && wlist->icon) {
|
||||
wlist->frame->workspace == scr->current_workspace) && wlist->icon) {
|
||||
if (!wlist->icon->mapped) {
|
||||
int x, y;
|
||||
|
||||
@@ -1627,17 +1627,17 @@ void wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurren
|
||||
wRaiseFrame(wlist->icon->core);
|
||||
}
|
||||
if (bringToCurrentWS)
|
||||
wWindowChangeWorkspace(wlist, w_global.workspace.current);
|
||||
wWindowChangeWorkspace(wlist, scr->current_workspace);
|
||||
wlist->flags.hidden = 0;
|
||||
if (miniwindows && wlist->frame->workspace == w_global.workspace.current)
|
||||
if (miniwindows && wlist->frame->workspace == scr->current_workspace)
|
||||
wDeiconifyWindow(wlist);
|
||||
WMPostNotificationName(WMNChangedState, wlist, "hide");
|
||||
} else if (wlist->flags.shaded) {
|
||||
if (bringToCurrentWS)
|
||||
wWindowChangeWorkspace(wlist, w_global.workspace.current);
|
||||
wWindowChangeWorkspace(wlist, scr->current_workspace);
|
||||
wlist->flags.hidden = 0;
|
||||
wRaiseFrame(wlist->frame->core);
|
||||
if (wlist->frame->workspace == w_global.workspace.current) {
|
||||
if (wlist->frame->workspace == scr->current_workspace) {
|
||||
XMapWindow(dpy, wlist->frame->core->window);
|
||||
if (miniwindows)
|
||||
wUnshadeWindow(wlist);
|
||||
@@ -1648,8 +1648,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 != w_global.workspace.current)
|
||||
wWindowChangeWorkspace(wlist, w_global.workspace.current);
|
||||
if (bringToCurrentWS && wlist->frame->workspace != scr->current_workspace)
|
||||
wWindowChangeWorkspace(wlist, scr->current_workspace);
|
||||
|
||||
wRaiseFrame(wlist->frame->core);
|
||||
}
|
||||
@@ -1683,7 +1683,7 @@ void wShowAllWindows(WScreen *scr)
|
||||
old_foc = wwin = scr->focused_window;
|
||||
while (wwin) {
|
||||
if (!wwin->flags.internal_window &&
|
||||
(w_global.workspace.current == wwin->frame->workspace || IS_OMNIPRESENT(wwin))) {
|
||||
(scr->current_workspace == wwin->frame->workspace || IS_OMNIPRESENT(wwin))) {
|
||||
if (wwin->flags.miniaturized) {
|
||||
wwin->flags.skip_next_animation = 1;
|
||||
wDeiconifyWindow(wwin);
|
||||
@@ -1802,7 +1802,7 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
||||
: vars[head].yo + vars[head].ys*(vars[head].si*isize))
|
||||
|
||||
/* arrange application icons */
|
||||
aicon = w_global.app_icon_list;
|
||||
aicon = scr->app_icon_list;
|
||||
/* reverse them to avoid unnecessarily sliding of icons */
|
||||
while (aicon && aicon->next)
|
||||
aicon = aicon->next;
|
||||
@@ -1838,7 +1838,7 @@ void wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
||||
|
||||
while (wwin) {
|
||||
if (wwin->icon && wwin->flags.miniaturized && !wwin->flags.hidden &&
|
||||
(wwin->frame->workspace == w_global.workspace.current ||
|
||||
(wwin->frame->workspace == scr->current_workspace ||
|
||||
IS_OMNIPRESENT(wwin) || wPreferences.sticky_icons)) {
|
||||
|
||||
head = wGetHeadForWindow(wwin);
|
||||
@@ -1907,7 +1907,7 @@ void wSelectWindow(WWindow *wwin, Bool flag)
|
||||
|
||||
void wMakeWindowVisible(WWindow *wwin)
|
||||
{
|
||||
if (wwin->frame->workspace != w_global.workspace.current)
|
||||
if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
|
||||
wWorkspaceChange(wwin->screen_ptr, wwin->frame->workspace);
|
||||
|
||||
if (wwin->flags.shaded)
|
||||
|
||||
+31
-29
@@ -67,8 +67,8 @@ static void iconDblClick(WObjDescriptor * desc, XEvent * event);
|
||||
static void iconExpose(WObjDescriptor * desc, XEvent * event);
|
||||
static void wApplicationSaveIconPathFor(const char *iconPath, const char *wm_instance, const char *wm_class);
|
||||
static WAppIcon *wAppIconCreate(WWindow * leader_win);
|
||||
static void add_to_appicon_list(WAppIcon *appicon);
|
||||
static void remove_from_appicon_list(WAppIcon *appicon);
|
||||
static void add_to_appicon_list(WScreen *scr, WAppIcon *appicon);
|
||||
static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon);
|
||||
static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window);
|
||||
|
||||
/* This function is used if the application is a .app. It checks if it has an icon in it
|
||||
@@ -115,7 +115,7 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *w
|
||||
aicon->yindex = -1;
|
||||
aicon->xindex = -1;
|
||||
|
||||
add_to_appicon_list(aicon);
|
||||
add_to_appicon_list(scr, aicon);
|
||||
|
||||
if (command)
|
||||
aicon->command = wstrdup(command);
|
||||
@@ -180,7 +180,7 @@ void unpaint_app_icon(WApplication *wapp)
|
||||
return;
|
||||
|
||||
scr = wapp->main_window_desc->screen_ptr;
|
||||
clip = w_global.workspace.array[w_global.workspace.current]->clip;
|
||||
clip = scr->workspaces[scr->current_workspace]->clip;
|
||||
|
||||
if (!clip || !aicon->attracted || !clip->collapsed)
|
||||
XUnmapWindow(dpy, aicon->icon->core->window);
|
||||
@@ -188,7 +188,7 @@ void unpaint_app_icon(WApplication *wapp)
|
||||
/* We want to avoid having it on the list because otherwise
|
||||
* there will be a hole when the icons are arranged with
|
||||
* wArrangeIcons() */
|
||||
remove_from_appicon_list(aicon);
|
||||
remove_from_appicon_list(scr, aicon);
|
||||
|
||||
if (wPreferences.auto_arrange_icons && !aicon->attracted)
|
||||
wArrangeIcons(scr, True);
|
||||
@@ -215,7 +215,7 @@ void paint_app_icon(WApplication *wapp)
|
||||
|
||||
attracting_dock = scr->attracting_drawer != NULL ?
|
||||
scr->attracting_drawer :
|
||||
w_global.workspace.array[w_global.workspace.current]->clip;
|
||||
scr->workspaces[scr->current_workspace]->clip;
|
||||
if (attracting_dock && attracting_dock->attract_icons &&
|
||||
wDockFindFreeSlot(attracting_dock, &x, &y)) {
|
||||
wapp->app_icon->attracted = 1;
|
||||
@@ -240,7 +240,7 @@ void paint_app_icon(WApplication *wapp)
|
||||
* having it on the list */
|
||||
if (!WFLAGP(wapp->main_window_desc, no_appicon) &&
|
||||
wapp->app_icon->next == NULL && wapp->app_icon->prev == NULL)
|
||||
add_to_appicon_list(wapp->app_icon);
|
||||
add_to_appicon_list(scr, wapp->app_icon);
|
||||
|
||||
if (!attracting_dock || !wapp->app_icon->attracted || !attracting_dock->collapsed)
|
||||
XMapWindow(dpy, icon->core->window);
|
||||
@@ -324,8 +324,10 @@ static WAppIcon *wAppIconCreate(WWindow *leader_win)
|
||||
return aicon;
|
||||
}
|
||||
|
||||
void wAppIconDestroy(WAppIcon *aicon)
|
||||
void wAppIconDestroy(WAppIcon * aicon)
|
||||
{
|
||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||
|
||||
RemoveFromStackList(aicon->icon->core);
|
||||
wIconDestroy(aicon->icon);
|
||||
if (aicon->command)
|
||||
@@ -340,7 +342,7 @@ void wAppIconDestroy(WAppIcon *aicon)
|
||||
if (aicon->wm_class)
|
||||
wfree(aicon->wm_class);
|
||||
|
||||
remove_from_appicon_list(aicon);
|
||||
remove_from_appicon_list(scr, aicon);
|
||||
|
||||
aicon->destroyed = 1;
|
||||
wrelease(aicon);
|
||||
@@ -378,7 +380,7 @@ static void updateDockNumbers(WScreen *scr)
|
||||
WAppIcon *dicon = scr->dock->icon_array[0];
|
||||
|
||||
ws_numbers = wmalloc(20);
|
||||
snprintf(ws_numbers, 20, "%i [ %i ]", w_global.workspace.current + 1, ((w_global.workspace.current / 10) + 1));
|
||||
snprintf(ws_numbers, 20, "%i [ %i ]", scr->current_workspace + 1, ((scr->current_workspace / 10) + 1));
|
||||
length = strlen(ws_numbers);
|
||||
|
||||
XClearArea(dpy, dicon->icon->core->window, 2, 2, 50, WMFontHeight(scr->icon_title_font) + 1, False);
|
||||
@@ -674,7 +676,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 != w_global.workspace.current)
|
||||
if (!unhideHere && wapp->last_workspace != scr->current_workspace)
|
||||
wWorkspaceChange(scr, wapp->last_workspace);
|
||||
|
||||
wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);
|
||||
@@ -816,8 +818,8 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
|
||||
allDocks[ i++ ] = scr->dock;
|
||||
|
||||
if (!wPreferences.flags.noclip &&
|
||||
originalDock != w_global.workspace.array[w_global.workspace.current]->clip)
|
||||
allDocks[i++] = w_global.workspace.array[w_global.workspace.current]->clip;
|
||||
originalDock != scr->workspaces[scr->current_workspace]->clip)
|
||||
allDocks[ i++ ] = scr->workspaces[scr->current_workspace]->clip;
|
||||
|
||||
for ( ; i < scr->drawer_count + 2; i++) /* In case the clip, the dock, or both, are disabled */
|
||||
allDocks[ i ] = NULL;
|
||||
@@ -868,11 +870,11 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
|
||||
|
||||
if (omnipresent && !showed_all_clips) {
|
||||
int i;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
if (i == w_global.workspace.current)
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (i == scr->current_workspace)
|
||||
continue;
|
||||
|
||||
wDockShowIcons(w_global.workspace.array[i]->clip);
|
||||
wDockShowIcons(scr->workspaces[i]->clip);
|
||||
/* Note: if dock is collapsed (for instance, because it
|
||||
auto-collapses), its icons still won't show up */
|
||||
}
|
||||
@@ -1074,11 +1076,11 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event)
|
||||
}
|
||||
if (showed_all_clips) {
|
||||
int i;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
if (i == w_global.workspace.current)
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (i == scr->current_workspace)
|
||||
continue;
|
||||
|
||||
wDockHideIcons(w_global.workspace.array[i]->clip);
|
||||
wDockHideIcons(scr->workspaces[i]->clip);
|
||||
}
|
||||
}
|
||||
if (wPreferences.auto_arrange_icons && !(originalDock != NULL && docked))
|
||||
@@ -1156,8 +1158,8 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m
|
||||
/* check clips */
|
||||
if (!wapp->app_icon) {
|
||||
int i;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
WDock *dock = w_global.workspace.array[i]->clip;
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
WDock *dock = scr->workspaces[i]->clip;
|
||||
|
||||
if (dock)
|
||||
wapp->app_icon = findDockIconFor(dock, main_window);
|
||||
@@ -1196,23 +1198,23 @@ static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window m
|
||||
}
|
||||
|
||||
/* Add the appicon to the appiconlist */
|
||||
static void add_to_appicon_list(WAppIcon *appicon)
|
||||
static void add_to_appicon_list(WScreen *scr, WAppIcon *appicon)
|
||||
{
|
||||
appicon->prev = NULL;
|
||||
appicon->next = w_global.app_icon_list;
|
||||
if (w_global.app_icon_list)
|
||||
w_global.app_icon_list->prev = appicon;
|
||||
appicon->next = scr->app_icon_list;
|
||||
if (scr->app_icon_list)
|
||||
scr->app_icon_list->prev = appicon;
|
||||
|
||||
w_global.app_icon_list = appicon;
|
||||
scr->app_icon_list = appicon;
|
||||
}
|
||||
|
||||
/* Remove the appicon from the appiconlist */
|
||||
static void remove_from_appicon_list(WAppIcon *appicon)
|
||||
static void remove_from_appicon_list(WScreen *scr, WAppIcon *appicon)
|
||||
{
|
||||
if (appicon == w_global.app_icon_list) {
|
||||
if (appicon == scr->app_icon_list) {
|
||||
if (appicon->next)
|
||||
appicon->next->prev = NULL;
|
||||
w_global.app_icon_list = appicon->next;
|
||||
scr->app_icon_list = appicon->next;
|
||||
} else {
|
||||
if (appicon->next)
|
||||
appicon->next->prev = appicon->prev;
|
||||
|
||||
@@ -146,6 +146,7 @@ WApplication *wApplicationCreate(WWindow * wwin)
|
||||
void wApplicationDestroy(WApplication *wapp)
|
||||
{
|
||||
WWindow *wwin;
|
||||
WScreen *scr;
|
||||
|
||||
if (!wapp)
|
||||
return;
|
||||
@@ -165,10 +166,18 @@ void wApplicationDestroy(WApplication *wapp)
|
||||
return;
|
||||
}
|
||||
|
||||
scr = wapp->main_window_desc->screen_ptr;
|
||||
|
||||
if (wapp == scr->wapp_list) {
|
||||
if (wapp->next)
|
||||
wapp->next->prev = NULL;
|
||||
scr->wapp_list = wapp->next;
|
||||
} else {
|
||||
if (wapp->next)
|
||||
wapp->next->prev = wapp->prev;
|
||||
if (wapp->prev)
|
||||
wapp->prev->next = wapp->next;
|
||||
}
|
||||
|
||||
XDeleteContext(dpy, wapp->main_window, w_global.context.app_win);
|
||||
wAppMenuDestroy(wapp->menu);
|
||||
|
||||
+3
-3
@@ -511,9 +511,9 @@ static void appiconBalloon(WObjDescriptor *object)
|
||||
char *tmp;
|
||||
|
||||
/* Show balloon if it is the Clip and the workspace name is > 5 chars */
|
||||
if (object->parent == w_global.clip.icon) {
|
||||
if (strlen(w_global.workspace.array[w_global.workspace.current]->name) > 5) {
|
||||
scr->balloon->text = wstrdup(w_global.workspace.array[w_global.workspace.current]->name);
|
||||
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);
|
||||
} else {
|
||||
wBalloonHide(scr);
|
||||
return;
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ void StartWindozeCycle(WWindow *wwin, XEvent *event, Bool next, Bool class_only)
|
||||
|
||||
oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr, False);
|
||||
} else {
|
||||
if (wwin->frame->workspace == w_global.workspace.current)
|
||||
if (wwin->frame->workspace == scr->current_workspace)
|
||||
newFocused = wwin;
|
||||
else
|
||||
newFocused = NULL;
|
||||
|
||||
+16
-16
@@ -1229,21 +1229,21 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
|
||||
WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL);
|
||||
|
||||
if (needs_refresh & REFRESH_WORKSPACE_MENU) {
|
||||
if (w_global.workspace.menu)
|
||||
wWorkspaceMenuUpdate(w_global.workspace.menu);
|
||||
if (w_global.clip.ws_menu)
|
||||
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
|
||||
if (w_global.workspace.submenu)
|
||||
w_global.workspace.submenu->flags.realized = 0;
|
||||
if (w_global.clip.submenu)
|
||||
w_global.clip.submenu->flags.realized = 0;
|
||||
if (scr->workspace_menu)
|
||||
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
|
||||
if (scr->clip_ws_menu)
|
||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||
if (scr->workspace_submenu)
|
||||
scr->workspace_submenu->flags.realized = 0;
|
||||
if (scr->clip_submenu)
|
||||
scr->clip_submenu->flags.realized = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wDefaultUpdateIcons(WScreen *scr)
|
||||
{
|
||||
WAppIcon *aicon = w_global.app_icon_list;
|
||||
WAppIcon *aicon = scr->app_icon_list;
|
||||
WDrawerChain *dc;
|
||||
WWindow *wwin = scr->focused_window;
|
||||
|
||||
@@ -1255,7 +1255,7 @@ void wDefaultUpdateIcons(WScreen *scr)
|
||||
}
|
||||
|
||||
if (!wPreferences.flags.noclip || wPreferences.flags.clip_merged_in_dock)
|
||||
wClipIconPaint();
|
||||
wClipIconPaint(scr->clip_icon);
|
||||
|
||||
for (dc = scr->drawers; dc != NULL; dc = dc->next)
|
||||
wDrawerIconPaint(dc->adrawer->icon_array[0]);
|
||||
@@ -2546,8 +2546,8 @@ static int setStickyIcons(WScreen * scr, WDefaultEntry * entry, void *bar, void
|
||||
(void) bar;
|
||||
(void) foo;
|
||||
|
||||
if (w_global.workspace.array) {
|
||||
wWorkspaceForceChange(scr, w_global.workspace.current);
|
||||
if (scr->workspaces) {
|
||||
wWorkspaceForceChange(scr, scr->current_workspace);
|
||||
wArrangeIcons(scr, False);
|
||||
}
|
||||
return 0;
|
||||
@@ -2710,10 +2710,10 @@ static int setLargeDisplayFont(WScreen *scr, WDefaultEntry *entry, void *tdata,
|
||||
(void) entry;
|
||||
(void) foo;
|
||||
|
||||
if (w_global.workspace.font_for_name)
|
||||
WMReleaseFont(w_global.workspace.font_for_name);
|
||||
if (scr->workspace_name_font)
|
||||
WMReleaseFont(scr->workspace_name_font);
|
||||
|
||||
w_global.workspace.font_for_name = font;
|
||||
scr->workspace_name_font = font;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3082,7 +3082,7 @@ static int setWorkspaceBack(WScreen * scr, WDefaultEntry * entry, void *tdata, v
|
||||
if (str) {
|
||||
SendHelperMessage(scr, 'S', 0, str);
|
||||
wfree(str);
|
||||
SendHelperMessage(scr, 'C', w_global.workspace.current + 1, NULL);
|
||||
SendHelperMessage(scr, 'C', scr->current_workspace + 1, NULL);
|
||||
} else {
|
||||
SendHelperMessage(scr, 'U', 0, NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ char *get_icon_filename(const char *winstance, const char *wclass, const char *c
|
||||
Bool default_icon);
|
||||
|
||||
|
||||
int wDefaultGetStartWorkspace(const char *instance, const char *class);
|
||||
int wDefaultGetStartWorkspace(WScreen *scr, const char *instance, const char *class);
|
||||
void wDefaultChangeIcon(const char *instance, const char* class, const char *file);
|
||||
RImage *get_rimage_from_file(WScreen *scr, const char *file_name, int max_size);
|
||||
|
||||
|
||||
+101
-97
@@ -174,9 +174,9 @@ static void renameCallback(WMenu *menu, WMenuEntry *entry)
|
||||
|
||||
assert(entry->clientdata != NULL);
|
||||
|
||||
wspace = w_global.workspace.current;
|
||||
wspace = dock->screen_ptr->current_workspace;
|
||||
|
||||
name = wstrdup(w_global.workspace.array[wspace]->name);
|
||||
name = wstrdup(dock->screen_ptr->workspaces[wspace]->name);
|
||||
|
||||
snprintf(buffer, sizeof(buffer), _("Type the name for workspace %i:"), wspace + 1);
|
||||
if (wInputDialog(dock->screen_ptr, _("Rename Workspace"), buffer, &name))
|
||||
@@ -539,7 +539,7 @@ static void keepIconsCallback(WMenu *menu, WMenuEntry *entry)
|
||||
selectedIcons = getSelected(dock);
|
||||
|
||||
if (!WMGetArrayItemCount(selectedIcons)
|
||||
&& clickedIcon != w_global.clip.icon) {
|
||||
&& clickedIcon != dock->screen_ptr->clip_icon) {
|
||||
char *command = NULL;
|
||||
|
||||
if (!clickedIcon->command && !clickedIcon->editing) {
|
||||
@@ -608,8 +608,8 @@ static void toggleAutoAttractCallback(WMenu *menu, WMenuEntry *entry)
|
||||
|
||||
if (!wPreferences.flags.noclip) {
|
||||
int i;
|
||||
for (i = 0; i < w_global.workspace.count; i++)
|
||||
w_global.workspace.array[i]->clip->attract_icons = False;
|
||||
for (i = 0; i < scr->workspace_count; i++)
|
||||
scr->workspaces[ i ]->clip->attract_icons = False;
|
||||
/* dock menu will be updated later, when opened */
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ static void attractIconsCallback(WMenu *menu, WMenuEntry *entry)
|
||||
assert(entry->clientdata != NULL);
|
||||
clip = clickedIcon->dock;
|
||||
|
||||
aicon = w_global.app_icon_list;
|
||||
aicon = clip->screen_ptr->app_icon_list;
|
||||
|
||||
while (aicon) {
|
||||
if (!aicon->docked && wDockFindFreeSlot(clip, &x, &y)) {
|
||||
@@ -824,8 +824,8 @@ static WAppIcon *mainIconCreate(WScreen *scr, int type, const char *name)
|
||||
|
||||
switch(type) {
|
||||
case WM_CLIP:
|
||||
if (w_global.clip.icon)
|
||||
return w_global.clip.icon;
|
||||
if (scr->clip_icon)
|
||||
return scr->clip_icon;
|
||||
|
||||
btn = wAppIconCreateForDock(scr, NULL, "Logo", "WMClip", TILE_CLIP);
|
||||
btn->icon->core->descriptor.handle_expose = clipIconExpose;
|
||||
@@ -860,7 +860,7 @@ static WAppIcon *mainIconCreate(WScreen *scr, int type, const char *name)
|
||||
btn->docked = 1;
|
||||
if (type == WM_CLIP ||
|
||||
(type == WM_DOCK && wPreferences.flags.clip_merged_in_dock))
|
||||
w_global.clip.icon = btn;
|
||||
scr->clip_icon = btn;
|
||||
|
||||
return btn;
|
||||
}
|
||||
@@ -868,6 +868,7 @@ static WAppIcon *mainIconCreate(WScreen *scr, int type, const char *name)
|
||||
static void switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
{
|
||||
WAppIcon *btn, *icon = (WAppIcon *) entry->clientdata;
|
||||
WScreen *scr = icon->icon->core->screen_ptr;
|
||||
WDock *src, *dest;
|
||||
WMArray *selectedIcons;
|
||||
int x, y;
|
||||
@@ -875,10 +876,11 @@ static void switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
/* Parameter not used, but tell the compiler that it is ok */
|
||||
(void) menu;
|
||||
|
||||
if (entry->order == w_global.workspace.current)
|
||||
if (entry->order == scr->current_workspace)
|
||||
return;
|
||||
|
||||
src = icon->dock;
|
||||
dest = w_global.workspace.array[entry->order]->clip;
|
||||
dest = scr->workspaces[entry->order]->clip;
|
||||
|
||||
selectedIcons = getSelected(src);
|
||||
|
||||
@@ -891,7 +893,7 @@ static void switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
XUnmapWindow(dpy, btn->icon->core->window);
|
||||
}
|
||||
}
|
||||
} else if (icon != w_global.clip.icon) {
|
||||
} else if (icon != scr->clip_icon) {
|
||||
if (wDockFindFreeSlot(dest, &x, &y)) {
|
||||
wDockMoveIconBetweenDocks(src, dest, icon, x, y);
|
||||
XUnmapWindow(dpy, icon->icon->core->window);
|
||||
@@ -945,30 +947,31 @@ static void launchDockedApplication(WAppIcon *btn, Bool withSelection)
|
||||
|
||||
static void updateWorkspaceMenu(WMenu *menu, WAppIcon *icon)
|
||||
{
|
||||
WScreen *scr = menu->frame->screen_ptr;
|
||||
char title[MAX_WORKSPACENAME_WIDTH + 1];
|
||||
int i;
|
||||
|
||||
if (!menu || !icon)
|
||||
return;
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (i < menu->entry_no) {
|
||||
if (strcmp(menu->entries[i]->text, w_global.workspace.array[i]->name) != 0) {
|
||||
if (strcmp(menu->entries[i]->text, scr->workspaces[i]->name) != 0) {
|
||||
wfree(menu->entries[i]->text);
|
||||
strcpy(title, w_global.workspace.array[i]->name);
|
||||
strcpy(title, scr->workspaces[i]->name);
|
||||
menu->entries[i]->text = wstrdup(title);
|
||||
menu->flags.realized = 0;
|
||||
}
|
||||
menu->entries[i]->clientdata = (void *)icon;
|
||||
} else {
|
||||
strcpy(title, w_global.workspace.array[i]->name);
|
||||
strcpy(title, scr->workspaces[i]->name);
|
||||
|
||||
wMenuAddCallback(menu, title, switchWSCommand, (void *)icon);
|
||||
|
||||
menu->flags.realized = 0;
|
||||
}
|
||||
|
||||
if (i == w_global.workspace.current)
|
||||
if (i == scr->current_workspace)
|
||||
wMenuSetEnabled(menu, i, False);
|
||||
else
|
||||
wMenuSetEnabled(menu, i, True);
|
||||
@@ -986,7 +989,7 @@ static WMenu *makeWorkspaceMenu(WScreen *scr)
|
||||
if (!menu)
|
||||
wwarning(_("could not create workspace submenu for Clip menu"));
|
||||
|
||||
wMenuAddCallback(menu, "", switchWSCommand, (void *)w_global.clip.icon);
|
||||
wMenuAddCallback(menu, "", switchWSCommand, (void *)scr->clip_icon);
|
||||
|
||||
menu->flags.realized = 0;
|
||||
wMenuRealize(menu);
|
||||
@@ -1208,18 +1211,18 @@ static WMenu *dockMenuCreate(WScreen *scr, int type)
|
||||
WMenu *menu;
|
||||
WMenuEntry *entry;
|
||||
|
||||
if (type == WM_CLIP && w_global.clip.menu)
|
||||
return w_global.clip.menu;
|
||||
if (type == WM_CLIP && scr->clip_menu)
|
||||
return scr->clip_menu;
|
||||
|
||||
if (type == WM_DRAWER && w_global.dock.drawer_menu)
|
||||
return w_global.dock.drawer_menu;
|
||||
if (type == WM_DRAWER && scr->drawer_menu)
|
||||
return scr->drawer_menu;
|
||||
|
||||
menu = wMenuCreate(scr, NULL, False);
|
||||
if (type == WM_DOCK) {
|
||||
entry = wMenuAddCallback(menu, _("Dock position"), NULL, NULL);
|
||||
if (w_global.dock.pos_menu == NULL)
|
||||
w_global.dock.pos_menu = makeDockPositionMenu(scr);
|
||||
wMenuEntrySetCascade(menu, entry, w_global.dock.pos_menu);
|
||||
if (scr->dock_pos_menu == NULL)
|
||||
scr->dock_pos_menu = makeDockPositionMenu(scr);
|
||||
wMenuEntrySetCascade(menu, entry, scr->dock_pos_menu);
|
||||
|
||||
if (!wPreferences.flags.nodrawer) {
|
||||
entry = wMenuAddCallback(menu, _("Add a drawer"), addADrawerCallback, NULL);
|
||||
@@ -1230,10 +1233,10 @@ static WMenu *dockMenuCreate(WScreen *scr, int type)
|
||||
else /* if (type == WM_DRAWER) */
|
||||
entry = wMenuAddCallback(menu, _("Drawer options"), NULL, NULL);
|
||||
|
||||
if (w_global.clip.opt_menu == NULL)
|
||||
w_global.clip.opt_menu = makeClipOptionsMenu(scr);
|
||||
if (scr->clip_options == NULL)
|
||||
scr->clip_options = makeClipOptionsMenu(scr);
|
||||
|
||||
wMenuEntrySetCascade(menu, entry, w_global.clip.opt_menu);
|
||||
wMenuEntrySetCascade(menu, entry, scr->clip_options);
|
||||
|
||||
/* The same menu is used for the dock and its appicons. If the menu
|
||||
* entry text is different between the two contexts, or if it can
|
||||
@@ -1262,9 +1265,9 @@ static WMenu *dockMenuCreate(WScreen *scr, int type)
|
||||
entry = wMenuAddCallback(menu, _("Move Icon To"), NULL, NULL);
|
||||
wfree(entry->text);
|
||||
entry->text = _("Move Icon To"); /* can be: Move Icons to */
|
||||
w_global.clip.submenu = makeWorkspaceMenu(scr);
|
||||
if (w_global.clip.submenu)
|
||||
wMenuEntrySetCascade(menu, entry, w_global.clip.submenu);
|
||||
scr->clip_submenu = makeWorkspaceMenu(scr);
|
||||
if (scr->clip_submenu)
|
||||
wMenuEntrySetCascade(menu, entry, scr->clip_submenu);
|
||||
}
|
||||
|
||||
entry = wMenuAddCallback(menu, _("Remove Icon"), removeIconsCallback, NULL);
|
||||
@@ -1289,10 +1292,10 @@ static WMenu *dockMenuCreate(WScreen *scr, int type)
|
||||
entry->text = _("Kill"); /* can be: Remove drawer */
|
||||
|
||||
if (type == WM_CLIP)
|
||||
w_global.clip.menu = menu;
|
||||
scr->clip_menu = menu;
|
||||
|
||||
if (type == WM_DRAWER)
|
||||
w_global.dock.drawer_menu = menu;
|
||||
scr->drawer_menu = menu;
|
||||
|
||||
return menu;
|
||||
}
|
||||
@@ -1386,11 +1389,10 @@ void wDockDestroy(WDock *dock)
|
||||
wfree(dock);
|
||||
}
|
||||
|
||||
void wClipIconPaint(void)
|
||||
void wClipIconPaint(WAppIcon *aicon)
|
||||
{
|
||||
WAppIcon *aicon = w_global.clip.icon;
|
||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||
WWorkspace *workspace = w_global.workspace.array[w_global.workspace.current];
|
||||
WWorkspace *workspace = scr->workspaces[scr->current_workspace];
|
||||
WMColor *color;
|
||||
Window win = aicon->icon->core->window;
|
||||
int length, nlength;
|
||||
@@ -1402,7 +1404,7 @@ void wClipIconPaint(void)
|
||||
length = strlen(workspace->name);
|
||||
ws_name = wmalloc(length + 1);
|
||||
snprintf(ws_name, length + 1, "%s", workspace->name);
|
||||
snprintf(ws_number, sizeof(ws_number), "%i", w_global.workspace.current + 1);
|
||||
snprintf(ws_number, sizeof(ws_number), "%i", scr->current_workspace + 1);
|
||||
nlength = strlen(ws_number);
|
||||
|
||||
if (wPreferences.flags.noclip || !workspace->clip->collapsed)
|
||||
@@ -1436,13 +1438,13 @@ static void clipIconExpose(WObjDescriptor *desc, XEvent *event)
|
||||
(void) desc;
|
||||
(void) event;
|
||||
|
||||
wClipIconPaint();
|
||||
wClipIconPaint(desc->parent);
|
||||
}
|
||||
|
||||
static void dockIconPaint(WAppIcon *btn)
|
||||
{
|
||||
if (btn == w_global.clip.icon) {
|
||||
wClipIconPaint();
|
||||
if (btn == btn->icon->core->screen_ptr->clip_icon) {
|
||||
wClipIconPaint(btn);
|
||||
} else if (wIsADrawer(btn)) {
|
||||
wDrawerIconPaint(btn);
|
||||
} else {
|
||||
@@ -1479,7 +1481,7 @@ static WMPropList *make_icon_state(WAppIcon *btn)
|
||||
|
||||
buggy = btn->buggy_app ? dYes : dNo;
|
||||
|
||||
if (!wPreferences.flags.clip_merged_in_dock && btn == w_global.clip.icon)
|
||||
if (!wPreferences.flags.clip_merged_in_dock && btn == btn->icon->core->screen_ptr->clip_icon)
|
||||
snprintf(buffer, sizeof(buffer), "%i,%i", btn->x_pos, btn->y_pos);
|
||||
else
|
||||
snprintf(buffer, sizeof(buffer), "%hi,%hi", btn->xindex, btn->yindex);
|
||||
@@ -1602,23 +1604,25 @@ void wDockSaveState(WScreen *scr, WMPropList *old_state)
|
||||
WMReleasePropList(keys);
|
||||
}
|
||||
|
||||
WMPutInPLDictionary(w_global.session_state, dDock, dock_state);
|
||||
WMPutInPLDictionary(scr->session_state, dDock, dock_state);
|
||||
|
||||
WMReleasePropList(dock_state);
|
||||
}
|
||||
|
||||
void wClipSaveState(void)
|
||||
void wClipSaveState(WScreen *scr)
|
||||
{
|
||||
WMPropList *clip_state;
|
||||
|
||||
clip_state = make_icon_state(w_global.clip.icon);
|
||||
clip_state = make_icon_state(scr->clip_icon);
|
||||
|
||||
WMPutInPLDictionary(scr->session_state, dClip, clip_state);
|
||||
|
||||
WMPutInPLDictionary(w_global.session_state, dClip, clip_state);
|
||||
WMReleasePropList(clip_state);
|
||||
}
|
||||
|
||||
WMPropList *wClipSaveWorkspaceState(int workspace)
|
||||
WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace)
|
||||
{
|
||||
return dockSaveState(w_global.workspace.array[workspace]->clip);
|
||||
return dockSaveState(scr->workspaces[workspace]->clip);
|
||||
}
|
||||
|
||||
static Bool getBooleanDockValue(WMPropList *value, WMPropList *key)
|
||||
@@ -1988,8 +1992,8 @@ WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
||||
* incremented in the loop above.
|
||||
*/
|
||||
} else if (old_top != dock->icon_array[0]) {
|
||||
if (old_top == w_global.clip.icon) /* TODO dande: understand the logic */
|
||||
w_global.clip.icon = dock->icon_array[0];
|
||||
if (old_top == scr->clip_icon) // TODO dande: understand the logic
|
||||
scr->clip_icon = dock->icon_array[0];
|
||||
|
||||
wAppIconDestroy(old_top);
|
||||
}
|
||||
@@ -2054,7 +2058,7 @@ static WDock *findDock(WScreen *scr, XEvent *event, int *icon_pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*icon_pos < 0 && (dock = w_global.workspace.array[w_global.workspace.current]->clip) != NULL) {
|
||||
if (*icon_pos < 0 && (dock = scr->workspaces[scr->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) {
|
||||
@@ -2601,12 +2605,12 @@ 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 : w_global.workspace.current;
|
||||
stop = icon->omnipresent ? w_global.workspace.count : start + 1;
|
||||
start = icon->omnipresent ? 0 : scr->current_workspace;
|
||||
stop = icon->omnipresent ? scr->workspace_count : start + 1;
|
||||
|
||||
aicon = NULL;
|
||||
for (k = start; k < stop; k++) {
|
||||
WDock *tmp = w_global.workspace.array[k]->clip;
|
||||
WDock *tmp = scr->workspaces[k]->clip;
|
||||
if (!tmp)
|
||||
continue;
|
||||
for (i = 0; i < tmp->max_icons; i++) {
|
||||
@@ -2620,7 +2624,7 @@ Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y, int *ret_x
|
||||
break;
|
||||
}
|
||||
for (k = start; k < stop; k++) {
|
||||
WDock *tmp = w_global.workspace.array[k]->clip;
|
||||
WDock *tmp = scr->workspaces[k]->clip;
|
||||
if (!tmp)
|
||||
continue;
|
||||
for (i = 0; i < tmp->max_icons; i++) {
|
||||
@@ -2731,7 +2735,7 @@ Bool wDockFindFreeSlot(WDock *dock, int *x_pos, int *y_pos)
|
||||
return True;
|
||||
}
|
||||
|
||||
if (dock->type == WM_CLIP && dock != w_global.workspace.array[w_global.workspace.current]->clip)
|
||||
if (dock->type == WM_CLIP && dock != scr->workspaces[scr->current_workspace]->clip)
|
||||
extra_count = scr->global_icon_count;
|
||||
|
||||
/* if the dock is full */
|
||||
@@ -3083,7 +3087,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 = w_global.workspace.current;
|
||||
state->workspace = scr->current_workspace;
|
||||
}
|
||||
wWindowAddSavedState(btn->wm_instance, btn->wm_class, cmdline, pid, state);
|
||||
wAddDeathHandler(pid, (WDeathHandler *) trackDeadProcess, btn->dock);
|
||||
@@ -3295,16 +3299,16 @@ void wDockTrackWindowLaunch(WDock *dock, Window window)
|
||||
void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace)
|
||||
{
|
||||
if (!wPreferences.flags.noclip) {
|
||||
w_global.clip.icon->dock = w_global.workspace.array[workspace]->clip;
|
||||
if (w_global.workspace.current != workspace) {
|
||||
WDock *old_clip = w_global.workspace.array[w_global.workspace.current]->clip;
|
||||
scr->clip_icon->dock = scr->workspaces[workspace]->clip;
|
||||
if (scr->current_workspace != workspace) {
|
||||
WDock *old_clip = scr->workspaces[scr->current_workspace]->clip;
|
||||
WAppIconChain *chain = scr->global_icons;
|
||||
|
||||
while (chain) {
|
||||
wDockMoveIconBetweenDocks(chain->aicon->dock,
|
||||
w_global.workspace.array[workspace]->clip,
|
||||
scr->workspaces[workspace]->clip,
|
||||
chain->aicon, chain->aicon->xindex, chain->aicon->yindex);
|
||||
if (w_global.workspace.array[workspace]->clip->collapsed)
|
||||
if (scr->workspaces[workspace]->clip->collapsed)
|
||||
XUnmapWindow(dpy, chain->aicon->icon->core->window);
|
||||
chain = chain->next;
|
||||
}
|
||||
@@ -3324,7 +3328,7 @@ void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace)
|
||||
}
|
||||
old_clip->collapsed = 1;
|
||||
}
|
||||
wDockShowIcons(w_global.workspace.array[workspace]->clip);
|
||||
wDockShowIcons(scr->workspaces[workspace]->clip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3433,7 +3437,7 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
|
||||
|
||||
if (dock->type == WM_DOCK) {
|
||||
/* Dock position menu */
|
||||
updateDockPositionMenu(w_global.dock.pos_menu, dock);
|
||||
updateDockPositionMenu(scr->dock_pos_menu, dock);
|
||||
dock->menu->flags.realized = 0;
|
||||
if (!wPreferences.flags.nodrawer) {
|
||||
/* add a drawer */
|
||||
@@ -3443,15 +3447,15 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
|
||||
}
|
||||
} else {
|
||||
/* clip/drawer options */
|
||||
if (w_global.clip.opt_menu)
|
||||
updateClipOptionsMenu(w_global.clip.opt_menu, dock);
|
||||
if (scr->clip_options)
|
||||
updateClipOptionsMenu(scr->clip_options, dock);
|
||||
|
||||
n_selected = numberOfSelectedIcons(dock);
|
||||
|
||||
if (dock->type == WM_CLIP) {
|
||||
/* Rename Workspace */
|
||||
entry = dock->menu->entries[++index];
|
||||
if (aicon == w_global.clip.icon) {
|
||||
if (aicon == scr->clip_icon) {
|
||||
entry->callback = renameCallback;
|
||||
entry->clientdata = dock;
|
||||
entry->flags.indicator = 0;
|
||||
@@ -3475,7 +3479,7 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
|
||||
entry = dock->menu->entries[++index];
|
||||
entry->clientdata = aicon;
|
||||
entry->flags.indicator_on = aicon->icon->selected;
|
||||
wMenuSetEnabled(dock->menu, index, aicon != w_global.clip.icon && !wIsADrawer(aicon));
|
||||
wMenuSetEnabled(dock->menu, index, aicon != scr->clip_icon && !wIsADrawer(aicon));
|
||||
|
||||
/* select/unselect all icons */
|
||||
entry = dock->menu->entries[++index];
|
||||
@@ -3505,8 +3509,8 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event)
|
||||
else
|
||||
entry->text = _("Move Icon To");
|
||||
|
||||
if (w_global.clip.submenu)
|
||||
updateWorkspaceMenu(w_global.clip.submenu, aicon);
|
||||
if (scr->clip_submenu)
|
||||
updateWorkspaceMenu(scr->clip_submenu, aicon);
|
||||
|
||||
wMenuSetEnabled(dock->menu, index, !aicon->omnipresent);
|
||||
}
|
||||
@@ -3616,7 +3620,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 != w_global.workspace.current && !unhideHere)
|
||||
if (wapp->last_workspace != dock->screen_ptr->current_workspace && !unhideHere)
|
||||
wWorkspaceChange(dock->screen_ptr, wapp->last_workspace);
|
||||
|
||||
wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere);
|
||||
@@ -3628,7 +3632,7 @@ static void iconDblClick(WObjDescriptor *desc, XEvent *event)
|
||||
if (event->xbutton.state & MOD_MASK) {
|
||||
/* raise/lower dock */
|
||||
toggleLowered(dock);
|
||||
} else if (btn == w_global.clip.icon) {
|
||||
} else if (btn == dock->screen_ptr->clip_icon) {
|
||||
if (getClipButton(event->xbutton.x, event->xbutton.y) != CLIP_IDLE)
|
||||
handleClipChangeWorkspace(dock->screen_ptr, event);
|
||||
else if (wPreferences.flags.clip_merged_in_dock) {
|
||||
@@ -3878,14 +3882,14 @@ static void handleClipChangeWorkspace(WScreen *scr, XEvent *event)
|
||||
XEvent ev;
|
||||
int done, direction, new_ws;
|
||||
int new_dir;
|
||||
WDock *clip = w_global.clip.icon->dock;
|
||||
WDock *clip = scr->clip_icon->dock;
|
||||
|
||||
direction = getClipButton(event->xbutton.x, event->xbutton.y);
|
||||
|
||||
clip->lclip_button_pushed = direction == CLIP_REWIND;
|
||||
clip->rclip_button_pushed = direction == CLIP_FORWARD;
|
||||
|
||||
wClipIconPaint();
|
||||
wClipIconPaint(scr->clip_icon);
|
||||
done = 0;
|
||||
while (!done) {
|
||||
WMMaskEvent(dpy, ExposureMask | ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, &ev);
|
||||
@@ -3900,7 +3904,7 @@ static void handleClipChangeWorkspace(WScreen *scr, XEvent *event)
|
||||
direction = new_dir;
|
||||
clip->lclip_button_pushed = direction == CLIP_REWIND;
|
||||
clip->rclip_button_pushed = direction == CLIP_FORWARD;
|
||||
wClipIconPaint();
|
||||
wClipIconPaint(scr->clip_icon);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3919,20 +3923,20 @@ static void handleClipChangeWorkspace(WScreen *scr, XEvent *event)
|
||||
new_ws = wPreferences.ws_advance || (event->xbutton.state & ControlMask);
|
||||
|
||||
if (direction == CLIP_FORWARD) {
|
||||
if (w_global.workspace.current < w_global.workspace.count - 1)
|
||||
wWorkspaceChange(scr, w_global.workspace.current + 1);
|
||||
else if (new_ws && w_global.workspace.current < MAX_WORKSPACES - 1)
|
||||
wWorkspaceChange(scr, w_global.workspace.current + 1);
|
||||
if (scr->current_workspace < scr->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);
|
||||
else if (wPreferences.ws_cycle)
|
||||
wWorkspaceChange(scr, 0);
|
||||
} else if (direction == CLIP_REWIND) {
|
||||
if (w_global.workspace.current > 0)
|
||||
wWorkspaceChange(scr, w_global.workspace.current - 1);
|
||||
else if (w_global.workspace.current == 0 && wPreferences.ws_cycle)
|
||||
wWorkspaceChange(scr, w_global.workspace.count - 1);
|
||||
if (scr->current_workspace > 0)
|
||||
wWorkspaceChange(scr, scr->current_workspace - 1);
|
||||
else if (scr->current_workspace == 0 && wPreferences.ws_cycle)
|
||||
wWorkspaceChange(scr, scr->workspace_count - 1);
|
||||
}
|
||||
|
||||
wClipIconPaint();
|
||||
wClipIconPaint(scr->clip_icon);
|
||||
}
|
||||
|
||||
static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
@@ -3964,7 +3968,7 @@ static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
else
|
||||
wDockRaise(dock);
|
||||
|
||||
if ((event->xbutton.state & ShiftMask) && aicon != w_global.clip.icon && dock->type != WM_DOCK) {
|
||||
if ((event->xbutton.state & ShiftMask) && aicon != scr->clip_icon && dock->type != WM_DOCK) {
|
||||
wIconSelect(aicon->icon);
|
||||
return;
|
||||
}
|
||||
@@ -3980,15 +3984,15 @@ static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
if (wPreferences.single_click && !hasMoved)
|
||||
iconDblClick(desc, event);
|
||||
}
|
||||
} else if (event->xbutton.button == Button2 && aicon == w_global.clip.icon) {
|
||||
if (!w_global.clip.ws_menu)
|
||||
w_global.clip.ws_menu = wWorkspaceMenuMake(scr, False);
|
||||
} else if (event->xbutton.button == Button2 && aicon == scr->clip_icon) {
|
||||
if (!scr->clip_ws_menu)
|
||||
scr->clip_ws_menu = wWorkspaceMenuMake(scr, False);
|
||||
|
||||
if (w_global.clip.ws_menu) {
|
||||
WMenu *wsMenu = w_global.clip.ws_menu;
|
||||
if (scr->clip_ws_menu) {
|
||||
WMenu *wsMenu = scr->clip_ws_menu;
|
||||
int xpos;
|
||||
|
||||
wWorkspaceMenuUpdate(wsMenu);
|
||||
wWorkspaceMenuUpdate(scr, wsMenu);
|
||||
|
||||
xpos = event->xbutton.x_root - wsMenu->frame->core->width / 2 - 1;
|
||||
if (xpos < 0) {
|
||||
@@ -4003,7 +4007,7 @@ static void iconMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||
(*desc->handle_mousedown) (desc, event);
|
||||
}
|
||||
} else if (event->xbutton.button == Button2 && dock->type == WM_CLIP &&
|
||||
(event->xbutton.state & ShiftMask) && aicon != w_global.clip.icon) {
|
||||
(event->xbutton.state & ShiftMask) && aicon != scr->clip_icon) {
|
||||
wClipMakeIconOmnipresent(aicon, !aicon->omnipresent);
|
||||
} else if (event->xbutton.button == Button3) {
|
||||
if (event->xbutton.send_event &&
|
||||
@@ -4182,8 +4186,8 @@ static Bool iconCanBeOmnipresent(WAppIcon *aicon)
|
||||
WAppIcon *btn;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
clip = w_global.workspace.array[i]->clip;
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
clip = scr->workspaces[i]->clip;
|
||||
|
||||
if (clip == aicon->dock)
|
||||
continue;
|
||||
@@ -4207,7 +4211,7 @@ int wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent)
|
||||
WAppIconChain *new_entry, *tmp, *tmp1;
|
||||
int status = WO_SUCCESS;
|
||||
|
||||
if ((scr->dock && aicon->dock == scr->dock) || aicon == w_global.clip.icon)
|
||||
if ((scr->dock && aicon->dock == scr->dock) || aicon == scr->clip_icon)
|
||||
return WO_NOT_APPLICABLE;
|
||||
|
||||
if (aicon->omnipresent == omnipresent)
|
||||
@@ -4956,7 +4960,7 @@ void wDrawersSaveState(WScreen *scr)
|
||||
WMAddToPLArray(all_drawers, drawer_state);
|
||||
WMReleasePropList(drawer_state);
|
||||
}
|
||||
WMPutInPLDictionary(w_global.session_state, dDrawers, all_drawers);
|
||||
WMPutInPLDictionary(scr->session_state, dDrawers, all_drawers);
|
||||
WMReleasePropList(all_drawers);
|
||||
}
|
||||
|
||||
@@ -4968,10 +4972,10 @@ void wDrawersRestoreState(WScreen *scr)
|
||||
|
||||
make_keys();
|
||||
|
||||
if (w_global.session_state == NULL)
|
||||
if (scr->session_state == NULL)
|
||||
return;
|
||||
|
||||
all_drawers = WMGetFromPLDictionary(w_global.session_state, dDrawers);
|
||||
all_drawers = WMGetFromPLDictionary(scr->session_state, dDrawers);
|
||||
if (!all_drawers)
|
||||
return;
|
||||
|
||||
|
||||
+3
-3
@@ -96,9 +96,9 @@ void wDockLaunchWithState(WAppIcon *btn, WSavedState *state);
|
||||
int wDockReceiveDNDDrop(WScreen *scr, XEvent *event);
|
||||
#endif
|
||||
|
||||
void wClipIconPaint(void);
|
||||
void wClipSaveState(void);
|
||||
WMPropList *wClipSaveWorkspaceState(int workspace);
|
||||
void wClipIconPaint(WAppIcon *aicon);
|
||||
void wClipSaveState(WScreen *scr);
|
||||
WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace);
|
||||
WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state);
|
||||
|
||||
void wDrawerIconPaint(WAppIcon *dicon);
|
||||
|
||||
+2
-2
@@ -181,8 +181,8 @@ static void panelBtnCallback(WMWidget * self, void *data)
|
||||
WAppIcon *aicon = panel->editedIcon;
|
||||
|
||||
// Cf dock.c:dockIconPaint(WAppIcon *aicon)?
|
||||
if (aicon == w_global.clip.icon)
|
||||
wClipIconPaint();
|
||||
if (aicon == aicon->icon->core->screen_ptr->clip_icon)
|
||||
wClipIconPaint(aicon);
|
||||
else if (wIsADrawer(aicon))
|
||||
wDrawerIconPaint(aicon);
|
||||
else
|
||||
|
||||
+31
-28
@@ -890,7 +890,7 @@ static void handleUnmapNotify(XEvent * event)
|
||||
return;
|
||||
|
||||
if (!wwin->flags.mapped && !withdraw
|
||||
&& wwin->frame->workspace == w_global.workspace.current
|
||||
&& wwin->frame->workspace == wwin->screen_ptr->current_workspace
|
||||
&& !wwin->flags.miniaturized && !wwin->flags.hidden)
|
||||
return;
|
||||
|
||||
@@ -1610,8 +1610,8 @@ static void handleKeyPress(XEvent * event)
|
||||
|
||||
case WKBD_WORKSPACE1 ... WKBD_WORKSPACE10:
|
||||
widx = command - WKBD_WORKSPACE1;
|
||||
i = (w_global.workspace.current / 10) * 10 + widx;
|
||||
if (wPreferences.ws_advance || i < w_global.workspace.count)
|
||||
i = (scr->current_workspace / 10) * 10 + widx;
|
||||
if (wPreferences.ws_advance || i < scr->workspace_count)
|
||||
wWorkspaceChange(scr, i);
|
||||
break;
|
||||
|
||||
@@ -1622,13 +1622,13 @@ static void handleKeyPress(XEvent * event)
|
||||
wWorkspaceRelativeChange(scr, -1);
|
||||
break;
|
||||
case WKBD_LASTWORKSPACE:
|
||||
wWorkspaceChange(scr, w_global.workspace.last_used);
|
||||
wWorkspaceChange(scr, scr->last_workspace);
|
||||
break;
|
||||
|
||||
case WKBD_MOVE_WORKSPACE1 ... WKBD_MOVE_WORKSPACE10:
|
||||
widx = command - WKBD_MOVE_WORKSPACE1;
|
||||
i = (w_global.workspace.current / 10) * 10 + widx;
|
||||
if (wwin && (wPreferences.ws_advance || i < w_global.workspace.count))
|
||||
i = (scr->current_workspace / 10) * 10 + widx;
|
||||
if (wwin && (wPreferences.ws_advance || i < scr->workspace_count))
|
||||
wWindowChangeWorkspace(wwin, i);
|
||||
break;
|
||||
|
||||
@@ -1642,7 +1642,7 @@ static void handleKeyPress(XEvent * event)
|
||||
break;
|
||||
case WKBD_MOVE_LASTWORKSPACE:
|
||||
if (wwin)
|
||||
wWindowChangeWorkspace(wwin, w_global.workspace.last_used);
|
||||
wWindowChangeWorkspace(wwin, scr->last_workspace);
|
||||
break;
|
||||
|
||||
case WKBD_MOVE_NEXTWSLAYER:
|
||||
@@ -1651,11 +1651,11 @@ static void handleKeyPress(XEvent * event)
|
||||
if (wwin) {
|
||||
int row, column;
|
||||
|
||||
row = w_global.workspace.current / 10;
|
||||
column = w_global.workspace.current % 10;
|
||||
row = scr->current_workspace / 10;
|
||||
column = scr->current_workspace % 10;
|
||||
|
||||
if (command == WKBD_MOVE_NEXTWSLAYER) {
|
||||
if ((row + 1) * 10 < w_global.workspace.count)
|
||||
if ((row + 1) * 10 < scr->workspace_count)
|
||||
wWindowChangeWorkspace(wwin, column + (row + 1) * 10);
|
||||
} else {
|
||||
if (row > 0)
|
||||
@@ -1678,8 +1678,8 @@ static void handleKeyPress(XEvent * event)
|
||||
|
||||
widx = command - WKBD_WINDOW1;
|
||||
|
||||
if (w_global.shortcut.windows[widx]) {
|
||||
WMArray *list = w_global.shortcut.windows[widx];
|
||||
if (scr->shortcutWindows[widx]) {
|
||||
WMArray *list = scr->shortcutWindows[widx];
|
||||
int cw;
|
||||
int count = WMGetArrayItemCount(list);
|
||||
WWindow *twin;
|
||||
@@ -1687,7 +1687,7 @@ static void handleKeyPress(XEvent * event)
|
||||
WWindow *wwin;
|
||||
|
||||
wUnselectWindows(scr);
|
||||
cw = w_global.workspace.current;
|
||||
cw = scr->current_workspace;
|
||||
|
||||
WM_ETARETI_ARRAY(list, wwin, iter) {
|
||||
if (count > 1)
|
||||
@@ -1705,16 +1705,18 @@ static void handleKeyPress(XEvent * event)
|
||||
WMAddToArray(list, twin);
|
||||
|
||||
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
|
||||
if (w_global.shortcut.windows[widx]) {
|
||||
WMFreeArray(w_global.shortcut.windows[widx]);
|
||||
w_global.shortcut.windows[widx] = NULL;
|
||||
if (scr->shortcutWindows[widx]) {
|
||||
WMFreeArray(scr->shortcutWindows[widx]);
|
||||
scr->shortcutWindows[widx] = NULL;
|
||||
}
|
||||
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
w_global.shortcut.windows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
scr->shortcutWindows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
|
||||
} else {
|
||||
w_global.shortcut.windows[widx] = WMCreateArray(4);
|
||||
WMAddToArray(w_global.shortcut.windows[widx], wwin);
|
||||
scr->shortcutWindows[widx] = WMCreateArray(4);
|
||||
WMAddToArray(scr->shortcutWindows[widx], wwin);
|
||||
}
|
||||
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
@@ -1724,11 +1726,12 @@ static void handleKeyPress(XEvent * event)
|
||||
XFlush(dpy);
|
||||
|
||||
} else if (scr->selected_windows && WMGetArrayItemCount(scr->selected_windows)) {
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
if (w_global.shortcut.windows[widx])
|
||||
WMFreeArray(w_global.shortcut.windows[widx]);
|
||||
|
||||
w_global.shortcut.windows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
if (scr->shortcutWindows[widx]) {
|
||||
WMFreeArray(scr->shortcutWindows[widx]);
|
||||
}
|
||||
scr->shortcutWindows[widx] = WMDuplicateArray(scr->selected_windows);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1788,11 +1791,11 @@ static void handleKeyPress(XEvent * event)
|
||||
{
|
||||
int row, column;
|
||||
|
||||
row = w_global.workspace.current / 10;
|
||||
column = w_global.workspace.current % 10;
|
||||
row = scr->current_workspace / 10;
|
||||
column = scr->current_workspace % 10;
|
||||
|
||||
if (command == WKBD_NEXTWSLAYER) {
|
||||
if ((row + 1) * 10 < w_global.workspace.count)
|
||||
if ((row + 1) * 10 < scr->workspace_count)
|
||||
wWorkspaceChange(scr, column + (row + 1) * 10);
|
||||
} else {
|
||||
if (row > 0)
|
||||
@@ -1802,7 +1805,7 @@ static void handleKeyPress(XEvent * event)
|
||||
break;
|
||||
case WKBD_CLIPRAISELOWER:
|
||||
if (!wPreferences.flags.noclip)
|
||||
wDockRaiseLower(w_global.workspace.array[w_global.workspace.current]->clip);
|
||||
wDockRaiseLower(scr->workspaces[scr->current_workspace]->clip);
|
||||
break;
|
||||
case WKBD_DOCKRAISELOWER:
|
||||
if (!wPreferences.flags.nodock)
|
||||
@@ -1815,7 +1818,7 @@ static void handleKeyPress(XEvent * event)
|
||||
wwin = scr->focused_window;
|
||||
|
||||
if (wwin && wwin->flags.mapped
|
||||
&& wwin->frame->workspace == w_global.workspace.current
|
||||
&& wwin->frame->workspace == wwin->screen_ptr->current_workspace
|
||||
&& !wwin->flags.miniaturized && !wwin->flags.hidden) {
|
||||
XkbGetState(dpy, XkbUseCoreKbd, &staterec);
|
||||
|
||||
|
||||
+1
-1
@@ -538,7 +538,7 @@ int main(int argc, char **argv)
|
||||
w_global.program.signal_state = WSTATE_NORMAL;
|
||||
w_global.timestamp.last_event = CurrentTime;
|
||||
w_global.timestamp.focus_change = CurrentTime;
|
||||
w_global.workspace.ignore_change = False;
|
||||
w_global.ignore_workspace_change = False;
|
||||
w_global.shortcut.modifiers_mask = 0xff;
|
||||
|
||||
/* setup common stuff for the monitor and wmaker itself */
|
||||
|
||||
+7
-6
@@ -1764,7 +1764,7 @@ static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
char *name;
|
||||
int number = entry_no - 3; /* Entries "New", "Destroy Last" and "Last Used" appear before workspaces */
|
||||
|
||||
name = wstrdup(w_global.workspace.array[number]->name);
|
||||
name = wstrdup(scr->workspaces[number]->name);
|
||||
snprintf(buffer, sizeof(buffer), _("Type the name for workspace %i:"), number + 1);
|
||||
|
||||
wMenuUnmap(scr->root_menu);
|
||||
@@ -2277,16 +2277,16 @@ void wMenuSaveState(WScreen * scr)
|
||||
if (saveMenuRecurs(menus, scr, scr->root_menu))
|
||||
save_menus = 1;
|
||||
|
||||
if (w_global.workspace.menu && w_global.workspace.menu->flags.buttoned) {
|
||||
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) {
|
||||
key = WMCreatePLString("WorkspaceMenu");
|
||||
saveMenuInfo(menus, w_global.workspace.menu, key);
|
||||
saveMenuInfo(menus, scr->workspace_menu, key);
|
||||
WMReleasePropList(key);
|
||||
save_menus = 1;
|
||||
}
|
||||
|
||||
if (save_menus) {
|
||||
key = WMCreatePLString("Menus");
|
||||
WMPutInPLDictionary(w_global.session_state, key, menus);
|
||||
WMPutInPLDictionary(scr->session_state, key, menus);
|
||||
WMReleasePropList(key);
|
||||
}
|
||||
WMReleasePropList(menus);
|
||||
@@ -2489,11 +2489,12 @@ void wMenuRestoreState(WScreen * scr)
|
||||
{
|
||||
WMPropList *menus, *menu, *key, *skey;
|
||||
|
||||
if (!w_global.session_state)
|
||||
if (!scr->session_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
key = WMCreatePLString("Menus");
|
||||
menus = WMGetFromPLDictionary(w_global.session_state, key);
|
||||
menus = WMGetFromPLDictionary(scr->session_state, key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
if (!menus)
|
||||
|
||||
+1
-1
@@ -586,7 +586,7 @@ char *ExpandOptions(WScreen *scr, const char *cmdline)
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "0x%x", (unsigned int)w_global.workspace.current + 1);
|
||||
snprintf(tmpbuf, sizeof(tmpbuf), "0x%x", (unsigned int)scr->current_workspace + 1);
|
||||
slen = strlen(tmpbuf);
|
||||
olen += slen;
|
||||
nout = realloc(out, olen);
|
||||
|
||||
+20
-20
@@ -754,7 +754,7 @@ static void updateMoveData(WWindow * wwin, MoveData * data)
|
||||
data->count = 0;
|
||||
tmp = scr->focused_window;
|
||||
while (tmp) {
|
||||
if (tmp != wwin && w_global.workspace.current == tmp->frame->workspace
|
||||
if (tmp != wwin && scr->current_workspace == tmp->frame->workspace
|
||||
&& !tmp->flags.miniaturized
|
||||
&& !tmp->flags.hidden && !tmp->flags.obscured && !WFLAGP(tmp, sunken)) {
|
||||
data->topList[data->count] = tmp;
|
||||
@@ -851,18 +851,18 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData * data, Bool opaqueMov
|
||||
Bool changed = False;
|
||||
|
||||
if (data->mouseX <= 1) {
|
||||
if (w_global.workspace.current > 0) {
|
||||
crossWorkspace(scr, wwin, opaqueMove, w_global.workspace.current - 1, True);
|
||||
if (scr->current_workspace > 0) {
|
||||
crossWorkspace(scr, wwin, opaqueMove, scr->current_workspace - 1, True);
|
||||
changed = True;
|
||||
data->rubCount = 0;
|
||||
} else if (w_global.workspace.current == 0 && wPreferences.ws_cycle) {
|
||||
crossWorkspace(scr, wwin, opaqueMove, w_global.workspace.count - 1, True);
|
||||
} else if (scr->current_workspace == 0 && wPreferences.ws_cycle) {
|
||||
crossWorkspace(scr, wwin, opaqueMove, scr->workspace_count - 1, True);
|
||||
changed = True;
|
||||
data->rubCount = 0;
|
||||
}
|
||||
} else if (data->mouseX >= scr->scr_width - 2) {
|
||||
if (w_global.workspace.current == w_global.workspace.count - 1) {
|
||||
if (wPreferences.ws_cycle || w_global.workspace.count == MAX_WORKSPACES) {
|
||||
if (scr->current_workspace == scr->workspace_count - 1) {
|
||||
if (wPreferences.ws_cycle || scr->workspace_count == MAX_WORKSPACES) {
|
||||
crossWorkspace(scr, wwin, opaqueMove, 0, False);
|
||||
changed = True;
|
||||
data->rubCount = 0;
|
||||
@@ -886,13 +886,13 @@ static Bool checkWorkspaceChange(WWindow * wwin, MoveData * data, Bool opaqueMov
|
||||
/* go to next workspace */
|
||||
wWorkspaceNew(scr);
|
||||
|
||||
crossWorkspace(scr, wwin, opaqueMove, w_global.workspace.current + 1, False);
|
||||
crossWorkspace(scr, wwin, opaqueMove, scr->current_workspace + 1, False);
|
||||
changed = True;
|
||||
data->rubCount = 0;
|
||||
}
|
||||
} else if (w_global.workspace.current < w_global.workspace.count) {
|
||||
} else if (scr->current_workspace < scr->workspace_count) {
|
||||
/* go to next workspace */
|
||||
crossWorkspace(scr, wwin, opaqueMove, w_global.workspace.current + 1, False);
|
||||
crossWorkspace(scr, wwin, opaqueMove, scr->current_workspace + 1, False);
|
||||
changed = True;
|
||||
data->rubCount = 0;
|
||||
}
|
||||
@@ -1513,17 +1513,17 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
|
||||
|
||||
if (wPreferences.ws_cycle) {
|
||||
if (src_x + off_x + ww < 20) {
|
||||
if (!w_global.workspace.current)
|
||||
wWorkspaceChange(scr, w_global.workspace.count - 1);
|
||||
if (!scr->current_workspace)
|
||||
wWorkspaceChange(scr, scr->workspace_count - 1);
|
||||
else
|
||||
wWorkspaceChange(scr, w_global.workspace.current - 1);
|
||||
wWorkspaceChange(scr, scr->current_workspace - 1);
|
||||
|
||||
off_x += scr_width;
|
||||
} else if (src_x + off_x + 20 > scr_width) {
|
||||
if (w_global.workspace.current == w_global.workspace.count - 1)
|
||||
if (scr->current_workspace == scr->workspace_count - 1)
|
||||
wWorkspaceChange(scr, 0);
|
||||
else
|
||||
wWorkspaceChange(scr, w_global.workspace.current + 1);
|
||||
wWorkspaceChange(scr, scr->current_workspace + 1);
|
||||
|
||||
off_x -= scr_width;
|
||||
}
|
||||
@@ -1642,7 +1642,7 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
|
||||
wWindowConfigure(wwin, src_x + off_x, src_y + off_y, ww, wh - vert_border);
|
||||
wWindowSynthConfigureNotify(wwin);
|
||||
}
|
||||
wWindowChangeWorkspace(wwin, w_global.workspace.current);
|
||||
wWindowChangeWorkspace(wwin, scr->current_workspace);
|
||||
wSetFocusTo(scr, wwin);
|
||||
}
|
||||
|
||||
@@ -1799,7 +1799,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
|
||||
draw_snap_frame(wwin, moveData.snap);
|
||||
|
||||
if (!warped && !wPreferences.no_autowrap) {
|
||||
int oldWorkspace = w_global.workspace.current;
|
||||
int oldWorkspace = scr->current_workspace;
|
||||
|
||||
if (wPreferences.move_display == WDIS_NEW && !scr->selected_windows) {
|
||||
showPosition(wwin, moveData.realX, moveData.realY);
|
||||
@@ -1811,7 +1811,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
|
||||
moveData.realY - wwin->frame_y);
|
||||
}
|
||||
if (checkWorkspaceChange(wwin, &moveData, opaqueMove)) {
|
||||
if (w_global.workspace.current != oldWorkspace
|
||||
if (scr->current_workspace != oldWorkspace
|
||||
&& wPreferences.edge_resistance > 0
|
||||
&& scr->selected_windows == NULL)
|
||||
updateMoveData(wwin, &moveData);
|
||||
@@ -1902,7 +1902,7 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
|
||||
XUngrabKeyboard(dpy, CurrentTime);
|
||||
XUngrabServer(dpy);
|
||||
if (!opaqueMove) {
|
||||
wWindowChangeWorkspace(wwin, w_global.workspace.current);
|
||||
wWindowChangeWorkspace(wwin, scr->current_workspace);
|
||||
wSetFocusTo(scr, wwin);
|
||||
}
|
||||
if (wPreferences.move_display == WDIS_NEW)
|
||||
@@ -2301,7 +2301,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 == w_global.workspace.current || IS_OMNIPRESENT(tmpw))
|
||||
if ((tmpw->frame->workspace == scr->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)) {
|
||||
|
||||
+3
-3
@@ -172,7 +172,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, w_global.workspace.current, &x, &y)) {
|
||||
if (iconPosition(obj, sx1, sy1, sx2, sy2, scr->current_workspace, &x, &y)) {
|
||||
int xdi, ydi; /* rounded down */
|
||||
int xui, yui; /* rounded up */
|
||||
|
||||
@@ -269,7 +269,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 == w_global.workspace.current &&
|
||||
test_window->frame->workspace == wwin->screen_ptr->current_workspace &&
|
||||
!(test_window->flags.miniaturized || test_window->flags.hidden))) {
|
||||
sum_isect += calcIntersectionArea(tx, ty, tw, th, x, y, w, h);
|
||||
}
|
||||
@@ -313,7 +313,7 @@ window_overlaps(WWindow *win, int x, int y, int w, int h, Bool ignore_sunken)
|
||||
(ty < (y + h)) && ((ty + th) > y) &&
|
||||
(win->flags.mapped ||
|
||||
(win->flags.shaded &&
|
||||
win->frame->workspace == w_global.workspace.current &&
|
||||
win->frame->workspace == win->screen_ptr->current_workspace &&
|
||||
!(win->flags.miniaturized || win->flags.hidden)))) {
|
||||
return True;
|
||||
}
|
||||
|
||||
+6
-6
@@ -302,12 +302,12 @@ static void saveSessionCommand(WMenu * menu, WMenuEntry * entry)
|
||||
wScreenSaveState(menu->frame->screen_ptr);
|
||||
}
|
||||
|
||||
static void clearSessionCommand(WMenu *menu, WMenuEntry *entry)
|
||||
static void clearSessionCommand(WMenu * menu, WMenuEntry * entry)
|
||||
{
|
||||
/* Parameter not used, but tell the compiler that it is ok */
|
||||
(void) entry;
|
||||
|
||||
wSessionClearState();
|
||||
wSessionClearState(menu->frame->screen_ptr);
|
||||
wScreenSaveState(menu->frame->screen_ptr);
|
||||
}
|
||||
|
||||
@@ -795,8 +795,8 @@ static void constructPLMenuFromPipe(WMenu * menu, WMenuEntry * entry)
|
||||
}
|
||||
static void cleanupWorkspaceMenu(WMenu *menu)
|
||||
{
|
||||
if (w_global.workspace.menu == menu)
|
||||
w_global.workspace.menu = NULL;
|
||||
if (menu->frame->screen_ptr->workspace_menu == menu)
|
||||
menu->frame->screen_ptr->workspace_menu = NULL;
|
||||
}
|
||||
|
||||
static WMenuEntry *addWorkspaceMenu(WScreen *scr, WMenu *menu, const char *title)
|
||||
@@ -814,11 +814,11 @@ static WMenuEntry *addWorkspaceMenu(WScreen *scr, WMenu *menu, const char *title
|
||||
wsmenu = wWorkspaceMenuMake(scr, True);
|
||||
wsmenu->on_destroy = cleanupWorkspaceMenu;
|
||||
|
||||
w_global.workspace.menu = wsmenu;
|
||||
scr->workspace_menu = wsmenu;
|
||||
entry = wMenuAddCallback(menu, title, NULL, NULL);
|
||||
wMenuEntrySetCascade(menu, entry, wsmenu);
|
||||
|
||||
wWorkspaceMenuUpdate(wsmenu);
|
||||
wWorkspaceMenuUpdate(scr, wsmenu);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
+18
-19
@@ -771,26 +771,25 @@ void wScreenRestoreState(WScreen * scr)
|
||||
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
||||
path = wdefaultspathfordomain(buf);
|
||||
}
|
||||
|
||||
w_global.session_state = WMReadPropListFromFile(path);
|
||||
scr->session_state = WMReadPropListFromFile(path);
|
||||
wfree(path);
|
||||
if (!w_global.session_state && w_global.screen_count > 1) {
|
||||
if (!scr->session_state && w_global.screen_count > 1) {
|
||||
path = wdefaultspathfordomain("WMState");
|
||||
w_global.session_state = WMReadPropListFromFile(path);
|
||||
scr->session_state = WMReadPropListFromFile(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
if (!w_global.session_state)
|
||||
w_global.session_state = WMCreatePLDictionary(NULL, NULL);
|
||||
if (!scr->session_state)
|
||||
scr->session_state = WMCreatePLDictionary(NULL, NULL);
|
||||
|
||||
if (!wPreferences.flags.nodock) {
|
||||
state = WMGetFromPLDictionary(w_global.session_state, dDock);
|
||||
state = WMGetFromPLDictionary(scr->session_state, dDock);
|
||||
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
|
||||
}
|
||||
|
||||
if (!wPreferences.flags.noclip) {
|
||||
state = WMGetFromPLDictionary(w_global.session_state, dClip);
|
||||
w_global.clip.icon = wClipRestoreState(scr, state);
|
||||
state = WMGetFromPLDictionary(scr->session_state, dClip);
|
||||
scr->clip_icon = wClipRestoreState(scr, state);
|
||||
}
|
||||
|
||||
if (!wPreferences.flags.nodrawer) {
|
||||
@@ -827,8 +826,8 @@ void wScreenSaveState(WScreen * scr)
|
||||
if (wPreferences.flags.noupdates)
|
||||
return;
|
||||
|
||||
old_state = w_global.session_state;
|
||||
w_global.session_state = WMCreatePLDictionary(NULL, NULL);
|
||||
old_state = scr->session_state;
|
||||
scr->session_state = WMCreatePLDictionary(NULL, NULL);
|
||||
|
||||
WMPLSetCaseSensitive(True);
|
||||
|
||||
@@ -837,24 +836,24 @@ void wScreenSaveState(WScreen * scr)
|
||||
wDockSaveState(scr, old_state);
|
||||
} else {
|
||||
if ((foo = WMGetFromPLDictionary(old_state, dDock)) != NULL) {
|
||||
WMPutInPLDictionary(w_global.session_state, dDock, foo);
|
||||
WMPutInPLDictionary(scr->session_state, dDock, foo);
|
||||
}
|
||||
}
|
||||
if (!wPreferences.flags.noclip) {
|
||||
wClipSaveState();
|
||||
wClipSaveState(scr);
|
||||
} else {
|
||||
if ((foo = WMGetFromPLDictionary(old_state, dClip)) != NULL) {
|
||||
WMPutInPLDictionary(w_global.session_state, dClip, foo);
|
||||
WMPutInPLDictionary(scr->session_state, dClip, foo);
|
||||
}
|
||||
}
|
||||
|
||||
wWorkspaceSaveState(old_state);
|
||||
wWorkspaceSaveState(scr, old_state);
|
||||
|
||||
if (!wPreferences.flags.nodrawer) {
|
||||
wDrawersSaveState(scr);
|
||||
} else {
|
||||
if ((foo = WMGetFromPLDictionary(old_state, dDrawers)) != NULL) {
|
||||
WMPutInPLDictionary(w_global.session_state, dDrawers, foo);
|
||||
WMPutInPLDictionary(scr->session_state, dDrawers, foo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,10 +862,10 @@ void wScreenSaveState(WScreen * scr)
|
||||
wSessionSaveState(scr);
|
||||
} else {
|
||||
if ((foo = WMGetFromPLDictionary(old_state, dApplications)) != NULL) {
|
||||
WMPutInPLDictionary(w_global.session_state, dApplications, foo);
|
||||
WMPutInPLDictionary(scr->session_state, dApplications, foo);
|
||||
}
|
||||
if ((foo = WMGetFromPLDictionary(old_state, dWorkspace)) != NULL) {
|
||||
WMPutInPLDictionary(w_global.session_state, dWorkspace, foo);
|
||||
WMPutInPLDictionary(scr->session_state, dWorkspace, foo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -882,7 +881,7 @@ void wScreenSaveState(WScreen * scr)
|
||||
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
||||
str = wdefaultspathfordomain(buf);
|
||||
}
|
||||
if (!WMWritePropListToFile(w_global.session_state, str)) {
|
||||
if (!WMWritePropListToFile(scr->session_state, str)) {
|
||||
werror(_("could not save session state in %s"), str);
|
||||
}
|
||||
wfree(str);
|
||||
|
||||
@@ -105,6 +105,10 @@ typedef struct _WScreen {
|
||||
|
||||
WMArray *fakeGroupLeaders; /* list of fake window group ids */
|
||||
|
||||
struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
|
||||
|
||||
struct WApplication *wapp_list; /* list of all aplications */
|
||||
|
||||
WMBag *stacking_list; /* bag of lists of windows
|
||||
* in stacking order.
|
||||
* Indexed by window level
|
||||
@@ -115,6 +119,14 @@ typedef struct _WScreen {
|
||||
|
||||
int window_count; /* number of windows in window_list */
|
||||
|
||||
int workspace_count; /* number of workspaces */
|
||||
|
||||
struct WWorkspace **workspaces; /* workspace array */
|
||||
|
||||
int current_workspace; /* current workspace number */
|
||||
int last_workspace; /* last used workspace number */
|
||||
|
||||
|
||||
WReservedArea *reservedAreas; /* used to build totalUsableArea */
|
||||
|
||||
WArea *usableArea; /* area of the workspace where
|
||||
@@ -149,6 +161,8 @@ typedef struct _WScreen {
|
||||
needs to be a core font so we can
|
||||
use it with a XORing GC */
|
||||
|
||||
WMFont *workspace_name_font;
|
||||
|
||||
WMColor *select_color;
|
||||
WMColor *select_text_color;
|
||||
/* foreground colors */
|
||||
@@ -205,12 +219,21 @@ typedef struct _WScreen {
|
||||
|
||||
struct WMenu *root_menu; /* root window menu */
|
||||
struct WMenu *switch_menu; /* window list menu */
|
||||
struct WMenu *workspace_menu; /* workspace operation */
|
||||
struct WMenu *window_menu; /* window command menu */
|
||||
struct WMenu *icon_menu; /* icon/appicon menu */
|
||||
struct WMenu *workspace_submenu; /* workspace list for window_menu */
|
||||
|
||||
struct WDock *dock; /* the application dock */
|
||||
struct WMenu *dock_pos_menu; /* Dock position menu */
|
||||
struct WPixmap *dock_dots; /* 3 dots for the Dock */
|
||||
Window dock_shadow; /* shadow for dock buttons */
|
||||
struct WAppIcon *clip_icon; /* The clip main icon, or the dock's, if they are merged */
|
||||
struct WMenu *clip_menu; /* Menu for clips */
|
||||
struct WMenu *clip_submenu; /* Workspace list for clips */
|
||||
struct WMenu *clip_options; /* Options for Clip */
|
||||
struct WMenu *clip_ws_menu; /* workspace menu for clip */
|
||||
struct WMenu *drawer_menu; /* Menu for drawers */
|
||||
struct WDock *last_dock;
|
||||
WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
|
||||
int global_icon_count; /* How many global icons do we have */
|
||||
@@ -237,6 +260,8 @@ typedef struct _WScreen {
|
||||
/* state and other informations */
|
||||
short cascade_index; /* for cascade window placement */
|
||||
|
||||
WMPropList *session_state;
|
||||
|
||||
/* for double-click detection */
|
||||
Time last_click_time;
|
||||
Window last_click_window;
|
||||
@@ -254,6 +279,10 @@ typedef struct _WScreen {
|
||||
WMHandlerID *autoRaiseTimer;
|
||||
Window autoRaiseWindow; /* window that is scheduled to be
|
||||
* raised */
|
||||
|
||||
/* for window shortcuts */
|
||||
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
|
||||
|
||||
#ifdef XDND
|
||||
char *xdestring;
|
||||
#endif
|
||||
|
||||
+33
-34
@@ -198,8 +198,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
||||
|
||||
name = WMCreatePLString(buffer);
|
||||
cmd = WMCreatePLString(command);
|
||||
workspace = WMCreatePLString(scr->workspaces[wwin->frame->workspace]->name);
|
||||
|
||||
workspace = WMCreatePLString(w_global.workspace.array[wwin->frame->workspace]->name);
|
||||
shaded = wwin->flags.shaded ? sYes : sNo;
|
||||
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
|
||||
hidden = wwin->flags.hidden ? sYes : sNo;
|
||||
@@ -208,8 +208,8 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
||||
geometry = WMCreatePLString(buffer);
|
||||
|
||||
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (w_global.shortcut.windows[i] != NULL &&
|
||||
WMGetFirstInArray(w_global.shortcut.windows[i], wwin) != WANotFound)
|
||||
if (scr->shortcutWindows[i] != NULL &&
|
||||
WMGetFirstInArray(scr->shortcutWindows[i], wwin) != WANotFound)
|
||||
mask |= 1 << i;
|
||||
}
|
||||
|
||||
@@ -237,11 +237,11 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp)
|
||||
|
||||
/* Try the clips */
|
||||
if (name == NULL) {
|
||||
for (i = 0; i < w_global.workspace.count; i++)
|
||||
if (w_global.workspace.array[i]->clip == wapp->app_icon->dock)
|
||||
for (i = 0; i < scr->workspace_count; i++)
|
||||
if (scr->workspaces[i]->clip == wapp->app_icon->dock)
|
||||
break;
|
||||
if (i < w_global.workspace.count)
|
||||
name = w_global.workspace.array[i]->name;
|
||||
if (i < scr->workspace_count)
|
||||
name = scr->workspaces[i]->name;
|
||||
}
|
||||
/* Try the drawers */
|
||||
if (name == NULL) {
|
||||
@@ -280,9 +280,9 @@ void wSessionSaveState(WScreen * scr)
|
||||
|
||||
make_keys();
|
||||
|
||||
if (!w_global.session_state) {
|
||||
w_global.session_state = WMCreatePLDictionary(NULL, NULL);
|
||||
if (!w_global.session_state)
|
||||
if (!scr->session_state) {
|
||||
scr->session_state = WMCreatePLDictionary(NULL, NULL);
|
||||
if (!scr->session_state)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -312,27 +312,26 @@ void wSessionSaveState(WScreen * scr)
|
||||
}
|
||||
wwin = wwin->prev;
|
||||
}
|
||||
|
||||
WMRemoveFromPLDictionary(w_global.session_state, sApplications);
|
||||
WMPutInPLDictionary(w_global.session_state, sApplications, list);
|
||||
WMRemoveFromPLDictionary(scr->session_state, sApplications);
|
||||
WMPutInPLDictionary(scr->session_state, sApplications, list);
|
||||
WMReleasePropList(list);
|
||||
|
||||
wks = WMCreatePLString(w_global.workspace.array[w_global.workspace.current]->name);
|
||||
WMPutInPLDictionary(w_global.session_state, sWorkspace, wks);
|
||||
wks = WMCreatePLString(scr->workspaces[scr->current_workspace]->name);
|
||||
WMPutInPLDictionary(scr->session_state, sWorkspace, wks);
|
||||
WMReleasePropList(wks);
|
||||
|
||||
WMFreeArray(wapp_list);
|
||||
}
|
||||
|
||||
void wSessionClearState(void)
|
||||
void wSessionClearState(WScreen * scr)
|
||||
{
|
||||
make_keys();
|
||||
|
||||
if (!w_global.session_state)
|
||||
if (!scr->session_state)
|
||||
return;
|
||||
|
||||
WMRemoveFromPLDictionary(w_global.session_state, sApplications);
|
||||
WMRemoveFromPLDictionary(w_global.session_state, sWorkspace);
|
||||
WMRemoveFromPLDictionary(scr->session_state, sApplications);
|
||||
WMRemoveFromPLDictionary(scr->session_state, sWorkspace);
|
||||
}
|
||||
|
||||
static pid_t execCommand(WScreen *scr, char *command)
|
||||
@@ -369,7 +368,7 @@ static pid_t execCommand(WScreen *scr, char *command)
|
||||
return pid;
|
||||
}
|
||||
|
||||
static WSavedState *getWindowState(WMPropList *win_state)
|
||||
static WSavedState *getWindowState(WScreen * scr, WMPropList * win_state)
|
||||
{
|
||||
WSavedState *state = wmalloc(sizeof(WSavedState));
|
||||
WMPropList *value;
|
||||
@@ -383,8 +382,8 @@ static WSavedState *getWindowState(WMPropList *win_state)
|
||||
tmp = WMGetFromPLString(value);
|
||||
if (sscanf(tmp, "%i", &state->workspace) != 1) {
|
||||
state->workspace = -1;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
if (strcmp(w_global.workspace.array[i]->name, tmp) == 0) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (strcmp(scr->workspaces[i]->name, tmp) == 0) {
|
||||
state->workspace = i;
|
||||
break;
|
||||
}
|
||||
@@ -432,12 +431,12 @@ void wSessionRestoreState(WScreen *scr)
|
||||
|
||||
make_keys();
|
||||
|
||||
if (!w_global.session_state)
|
||||
if (!scr->session_state)
|
||||
return;
|
||||
|
||||
WMPLSetCaseSensitive(True);
|
||||
|
||||
apps = WMGetFromPLDictionary(w_global.session_state, sApplications);
|
||||
apps = WMGetFromPLDictionary(scr->session_state, sApplications);
|
||||
if (!apps)
|
||||
return;
|
||||
|
||||
@@ -461,7 +460,7 @@ void wSessionRestoreState(WScreen *scr)
|
||||
if (!instance && !class)
|
||||
continue;
|
||||
|
||||
state = getWindowState(win_info);
|
||||
state = getWindowState(scr, win_info);
|
||||
|
||||
dock = NULL;
|
||||
value = WMGetFromPLDictionary(win_info, sDock);
|
||||
@@ -472,9 +471,9 @@ void wSessionRestoreState(WScreen *scr)
|
||||
|
||||
/* Try the clips */
|
||||
if (dock == NULL) {
|
||||
for (j = 0; j < w_global.workspace.count; j++) {
|
||||
if (strcmp(w_global.workspace.array[j]->name, tmp) == 0) {
|
||||
dock = w_global.workspace.array[j]->clip;
|
||||
for (j = 0; j < scr->workspace_count; j++) {
|
||||
if (strcmp(scr->workspaces[j]->name, tmp) == 0) {
|
||||
dock = scr->workspaces[j]->clip;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -494,8 +493,8 @@ void wSessionRestoreState(WScreen *scr)
|
||||
} else {
|
||||
if (n == 0) {
|
||||
dock = scr->dock;
|
||||
} else if (n > 0 && n <= w_global.workspace.count) {
|
||||
dock = w_global.workspace.array[n - 1]->clip;
|
||||
} else if (n > 0 && n <= scr->workspace_count) {
|
||||
dock = scr->workspaces[n - 1]->clip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -537,12 +536,12 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
|
||||
|
||||
make_keys();
|
||||
|
||||
if (!w_global.session_state)
|
||||
if (!scr->session_state)
|
||||
return;
|
||||
|
||||
WMPLSetCaseSensitive(True);
|
||||
|
||||
wks = WMGetFromPLDictionary(w_global.session_state, sWorkspace);
|
||||
wks = WMGetFromPLDictionary(scr->session_state, sWorkspace);
|
||||
if (!wks || !WMIsPLString(wks))
|
||||
return;
|
||||
|
||||
@@ -555,8 +554,8 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
|
||||
WMPLSetCaseSensitive(False);
|
||||
|
||||
/* Get the workspace number for the workspace name */
|
||||
w = wGetWorkspaceNumber(value);
|
||||
w = wGetWorkspaceNumber(scr, value);
|
||||
|
||||
if (w != w_global.workspace.current && w < w_global.workspace.count)
|
||||
if (w != scr->current_workspace && w < scr->workspace_count)
|
||||
wWorkspaceChange(scr, w);
|
||||
}
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#define WMSESSION_H_
|
||||
|
||||
void wSessionSaveState(WScreen *scr);
|
||||
void wSessionClearState(void);
|
||||
void wSessionClearState(WScreen *scr);
|
||||
void wSessionRestoreState(WScreen *scr);
|
||||
void wSessionRestoreLastWorkspace(WScreen *scr);
|
||||
#endif
|
||||
|
||||
+6
-6
@@ -674,10 +674,10 @@ void StartUp(Bool defaultScreenOnly)
|
||||
/* auto-launch apps in clip */
|
||||
if (!wPreferences.flags.noclip) {
|
||||
int i;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
if (w_global.workspace.array[i]->clip) {
|
||||
wScreen[j]->last_dock = w_global.workspace.array[i]->clip;
|
||||
wDockDoAutoLaunch(w_global.workspace.array[i]->clip, i);
|
||||
for (i = 0; i < wScreen[j]->workspace_count; i++) {
|
||||
if (wScreen[j]->workspaces[i]->clip) {
|
||||
wScreen[j]->last_dock = wScreen[j]->workspaces[i]->clip;
|
||||
wDockDoAutoLaunch(wScreen[j]->workspaces[i]->clip, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -828,9 +828,9 @@ static void manageAllWindows(WScreen * scr, int crashRecovery)
|
||||
WMNextEvent(dpy, &ev);
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
w_global.workspace.last_used = 0;
|
||||
scr->last_workspace = 0;
|
||||
wWorkspaceForceChange(scr, 0);
|
||||
if (!wPreferences.flags.noclip)
|
||||
wDockShowIcons(w_global.workspace.array[w_global.workspace.current]->clip);
|
||||
wDockShowIcons(scr->workspaces[scr->current_workspace]->clip);
|
||||
scr->flags.startup2 = 0;
|
||||
}
|
||||
|
||||
+3
-3
@@ -227,7 +227,7 @@ void UpdateSwitchMenu(WScreen * scr, WWindow * wwin, int action)
|
||||
snprintf(entry->rtext, MAX_WORKSPACENAME_WIDTH, "[*]");
|
||||
else
|
||||
snprintf(entry->rtext, MAX_WORKSPACENAME_WIDTH, "[%s]",
|
||||
w_global.workspace.array[wwin->frame->workspace]->name);
|
||||
scr->workspaces[wwin->frame->workspace]->name);
|
||||
|
||||
if (wwin->flags.hidden) {
|
||||
entry->flags.indicator_type = MI_HIDDEN;
|
||||
@@ -285,7 +285,7 @@ void UpdateSwitchMenu(WScreen * scr, WWindow * wwin, int action)
|
||||
} else {
|
||||
snprintf(entry->rtext, MAX_WORKSPACENAME_WIDTH,
|
||||
"[%s]",
|
||||
w_global.workspace.array[wwin->frame->workspace]->name);
|
||||
scr->workspaces[wwin->frame->workspace]->name);
|
||||
}
|
||||
|
||||
rt = entry->rtext;
|
||||
@@ -363,7 +363,7 @@ static void UpdateSwitchMenuWorkspace(WScreen *scr, int workspace)
|
||||
snprintf(menu->entries[i]->rtext, MAX_WORKSPACENAME_WIDTH, "[*]");
|
||||
else
|
||||
snprintf(menu->entries[i]->rtext, MAX_WORKSPACENAME_WIDTH, "[%s]",
|
||||
w_global.workspace.array[wwin->frame->workspace]->name);
|
||||
scr->workspaces[wwin->frame->workspace]->name);
|
||||
menu->flags.realized = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ struct SwitchPanel {
|
||||
|
||||
static int canReceiveFocus(WWindow *wwin)
|
||||
{
|
||||
if (wwin->frame->workspace != w_global.workspace.current)
|
||||
if (wwin->frame->workspace != wwin->screen_ptr->current_workspace)
|
||||
return 0;
|
||||
|
||||
if (wPreferences.cycle_active_head_only &&
|
||||
|
||||
+2
-2
@@ -479,7 +479,7 @@ RImage *get_icon_image(WScreen *scr, const char *winstance, const char *wclass,
|
||||
return get_rimage_from_file(scr, file_name, max_size);
|
||||
}
|
||||
|
||||
int wDefaultGetStartWorkspace(const char *instance, const char *class)
|
||||
int wDefaultGetStartWorkspace(WScreen *scr, const char *instance, const char *class)
|
||||
{
|
||||
WMPropList *value;
|
||||
int w;
|
||||
@@ -502,7 +502,7 @@ int wDefaultGetStartWorkspace(const char *instance, const char *class)
|
||||
return -1;
|
||||
|
||||
/* Get the workspace number for the workspace name */
|
||||
w = wGetWorkspaceNumber(tmp);
|
||||
w = wGetWorkspaceNumber(scr, tmp);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
+32
-31
@@ -178,14 +178,14 @@ void wWindowDestroy(WWindow *wwin)
|
||||
wwin->flags.destroyed = 1;
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (!w_global.shortcut.windows[i])
|
||||
if (!wwin->screen_ptr->shortcutWindows[i])
|
||||
continue;
|
||||
|
||||
WMRemoveFromArray(w_global.shortcut.windows[i], wwin);
|
||||
WMRemoveFromArray(wwin->screen_ptr->shortcutWindows[i], wwin);
|
||||
|
||||
if (!WMGetArrayItemCount(w_global.shortcut.windows[i])) {
|
||||
WMFreeArray(w_global.shortcut.windows[i]);
|
||||
w_global.shortcut.windows[i] = NULL;
|
||||
if (!WMGetArrayItemCount(wwin->screen_ptr->shortcutWindows[i])) {
|
||||
WMFreeArray(wwin->screen_ptr->shortcutWindows[i]);
|
||||
wwin->screen_ptr->shortcutWindows[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ void wWindowSetupInitialAttributes(WWindow *wwin, int *level, int *workspace)
|
||||
}
|
||||
|
||||
if (tmp_workspace >= 0)
|
||||
*workspace = tmp_workspace % w_global.workspace.count;
|
||||
*workspace = tmp_workspace % scr->workspace_count;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -833,16 +833,17 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
||||
wwin->flags.miniaturized = win_state->state->miniaturized;
|
||||
|
||||
if (!IS_OMNIPRESENT(wwin)) {
|
||||
int w = wDefaultGetStartWorkspace(wwin->wm_instance, wwin->wm_class);
|
||||
if (w < 0 || w >= w_global.workspace.count) {
|
||||
int w = wDefaultGetStartWorkspace(scr, wwin->wm_instance,
|
||||
wwin->wm_class);
|
||||
if (w < 0 || w >= scr->workspace_count) {
|
||||
workspace = win_state->state->workspace;
|
||||
if (workspace >= w_global.workspace.count)
|
||||
workspace = w_global.workspace.current;
|
||||
if (workspace >= scr->workspace_count)
|
||||
workspace = scr->current_workspace;
|
||||
} else {
|
||||
workspace = w;
|
||||
}
|
||||
} else {
|
||||
workspace = w_global.workspace.current;
|
||||
workspace = scr->current_workspace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -883,10 +884,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (mask & (1 << i)) {
|
||||
if (!w_global.shortcut.windows[i])
|
||||
w_global.shortcut.windows[i] = WMCreateArray(4);
|
||||
if (!scr->shortcutWindows[i])
|
||||
scr->shortcutWindows[i] = WMCreateArray(4);
|
||||
|
||||
WMAddToArray(w_global.shortcut.windows[i], wwin);
|
||||
WMAddToArray(scr->shortcutWindows[i], wwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -905,20 +906,20 @@ WWindow *wManageWindow(WScreen *scr, Window window)
|
||||
|
||||
/* set workspace on which the window starts */
|
||||
if (workspace >= 0) {
|
||||
if (workspace > w_global.workspace.count - 1)
|
||||
workspace = workspace % w_global.workspace.count;
|
||||
if (workspace > scr->workspace_count - 1)
|
||||
workspace = workspace % scr->workspace_count;
|
||||
} else {
|
||||
int w;
|
||||
|
||||
w = wDefaultGetStartWorkspace(wwin->wm_instance, wwin->wm_class);
|
||||
w = wDefaultGetStartWorkspace(scr, wwin->wm_instance, wwin->wm_class);
|
||||
|
||||
if (w >= 0 && w < w_global.workspace.count && !(IS_OMNIPRESENT(wwin))) {
|
||||
if (w >= 0 && w < scr->workspace_count && !(IS_OMNIPRESENT(wwin))) {
|
||||
workspace = w;
|
||||
} else {
|
||||
if (wPreferences.open_transients_with_parent && transientOwner)
|
||||
workspace = transientOwner->frame->workspace;
|
||||
else
|
||||
workspace = w_global.workspace.current;
|
||||
workspace = scr->current_workspace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -942,7 +943,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 == w_global.workspace.current
|
||||
&& workspace == scr->current_workspace
|
||||
&& !wwin->flags.miniaturized
|
||||
&& !wwin->flags.maximized && !(wwin->normal_hints->flags & (USPosition | PPosition))) {
|
||||
|
||||
@@ -1183,7 +1184,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 == w_global.workspace.current || IS_OMNIPRESENT(wwin))
|
||||
if (!wwin->flags.miniaturized && (workspace == scr->current_workspace || IS_OMNIPRESENT(wwin))
|
||||
&& !wwin->flags.hidden && !withdraw) {
|
||||
|
||||
/* The following "if" is to avoid crashing of clients that expect
|
||||
@@ -1257,7 +1258,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 == w_global.workspace.current && !wwin->flags.hidden) {
|
||||
if (!wwin->flags.miniaturized && workspace == scr->current_workspace && !wwin->flags.hidden) {
|
||||
if (((transientOwner && transientOwner->flags.focused)
|
||||
|| wPreferences.auto_focus) && !WFLAGP(wwin, no_focusable)) {
|
||||
|
||||
@@ -1366,7 +1367,7 @@ WWindow *wManageInternalWindow(WScreen *scr, Window window, Window owner,
|
||||
wFrameWindowHideButton(wwin->frame, WFF_RIGHT_BUTTON);
|
||||
|
||||
wwin->frame->child = wwin;
|
||||
wwin->frame->workspace = w_global.workspace.current;
|
||||
wwin->frame->workspace = wwin->screen_ptr->current_workspace;
|
||||
|
||||
#ifdef XKB_BUTTON_HINT
|
||||
if (wPreferences.modelock)
|
||||
@@ -1921,10 +1922,10 @@ void wWindowChangeWorkspace(WWindow *wwin, int workspace)
|
||||
WApplication *wapp;
|
||||
int unmap = 0;
|
||||
|
||||
if (workspace >= w_global.workspace.count || workspace < 0 || workspace == wwin->frame->workspace)
|
||||
if (workspace >= scr->workspace_count || workspace < 0 || workspace == wwin->frame->workspace)
|
||||
return;
|
||||
|
||||
if (workspace != w_global.workspace.current) {
|
||||
if (workspace != scr->current_workspace) {
|
||||
/* Sent to other workspace. Unmap window */
|
||||
if ((wwin->flags.mapped
|
||||
|| wwin->flags.shaded || (wwin->flags.miniaturized && !wPreferences.sticky_icons))
|
||||
@@ -1968,23 +1969,23 @@ void wWindowChangeWorkspace(WWindow *wwin, int workspace)
|
||||
void wWindowChangeWorkspaceRelative(WWindow *wwin, int amount)
|
||||
{
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
int w = w_global.workspace.current + amount;
|
||||
int w = scr->current_workspace + amount;
|
||||
|
||||
if (amount < 0) {
|
||||
if (w >= 0) {
|
||||
wWindowChangeWorkspace(wwin, w);
|
||||
} else if (wPreferences.ws_cycle) {
|
||||
wWindowChangeWorkspace(wwin, w_global.workspace.count + w);
|
||||
wWindowChangeWorkspace(wwin, scr->workspace_count + w);
|
||||
}
|
||||
} else if (amount > 0) {
|
||||
if (w < w_global.workspace.count) {
|
||||
if (w < scr->workspace_count) {
|
||||
wWindowChangeWorkspace(wwin, w);
|
||||
} else if (wPreferences.ws_advance) {
|
||||
int workspace = WMIN(w, MAX_WORKSPACES - 1);
|
||||
wWorkspaceMake(scr, workspace);
|
||||
wWindowChangeWorkspace(wwin, workspace);
|
||||
} else if (wPreferences.ws_cycle) {
|
||||
wWindowChangeWorkspace(wwin, w % w_global.workspace.count);
|
||||
wWindowChangeWorkspace(wwin, w % scr->workspace_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2351,8 +2352,8 @@ void wWindowSaveState(WWindow *wwin)
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||
if (w_global.shortcut.windows[i] &&
|
||||
WMCountInArray(w_global.shortcut.windows[i], wwin))
|
||||
if (wwin->screen_ptr->shortcutWindows[i] &&
|
||||
WMCountInArray(wwin->screen_ptr->shortcutWindows[i], wwin))
|
||||
data[9] |= 1 << i;
|
||||
}
|
||||
|
||||
|
||||
+37
-28
@@ -279,7 +279,7 @@ static void switchWSCommand(WMenu * menu, WMenuEntry * entry)
|
||||
wWindowChangeWorkspace(wwin, entry->order);
|
||||
}
|
||||
|
||||
static void makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||
static void makeShortcutCommand(WMenu * menu, WMenuEntry * entry)
|
||||
{
|
||||
WWindow *wwin = (WWindow *) entry->clientdata;
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
@@ -288,16 +288,18 @@ static void makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||
/* Parameter not used, but tell the compiler that it is ok */
|
||||
(void) menu;
|
||||
|
||||
if (w_global.shortcut.windows[index]) {
|
||||
WMFreeArray(w_global.shortcut.windows[index]);
|
||||
w_global.shortcut.windows[index] = NULL;
|
||||
if (scr->shortcutWindows[index]) {
|
||||
WMFreeArray(scr->shortcutWindows[index]);
|
||||
scr->shortcutWindows[index] = NULL;
|
||||
}
|
||||
|
||||
if (wwin->flags.selected && scr->selected_windows) {
|
||||
w_global.shortcut.windows[index] = WMDuplicateArray(scr->selected_windows);
|
||||
scr->shortcutWindows[index] = WMDuplicateArray(scr->selected_windows);
|
||||
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
|
||||
WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
|
||||
} else {
|
||||
w_global.shortcut.windows[index] = WMCreateArray(4);
|
||||
WMAddToArray(w_global.shortcut.windows[index], wwin);
|
||||
scr->shortcutWindows[index] = WMCreateArray(4);
|
||||
WMAddToArray(scr->shortcutWindows[index], wwin);
|
||||
}
|
||||
|
||||
wSelectWindow(wwin, !wwin->flags.selected);
|
||||
@@ -309,24 +311,25 @@ static void makeShortcutCommand(WMenu *menu, WMenuEntry *entry)
|
||||
|
||||
static void updateWorkspaceMenu(WMenu * menu)
|
||||
{
|
||||
WScreen *scr = menu->frame->screen_ptr;
|
||||
char title[MAX_WORKSPACENAME_WIDTH + 1];
|
||||
WMenuEntry *entry;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (i < menu->entry_no) {
|
||||
|
||||
entry = menu->entries[i];
|
||||
if (strcmp(entry->text, w_global.workspace.array[i]->name) != 0) {
|
||||
if (strcmp(entry->text, scr->workspaces[i]->name) != 0) {
|
||||
wfree(entry->text);
|
||||
strncpy(title, w_global.workspace.array[i]->name, MAX_WORKSPACENAME_WIDTH);
|
||||
strncpy(title, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
|
||||
title[MAX_WORKSPACENAME_WIDTH] = 0;
|
||||
menu->entries[i]->text = wstrdup(title);
|
||||
menu->entries[i]->rtext = GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + i]);
|
||||
menu->flags.realized = 0;
|
||||
}
|
||||
} else {
|
||||
strncpy(title, w_global.workspace.array[i]->name, MAX_WORKSPACENAME_WIDTH);
|
||||
strncpy(title, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
|
||||
title[MAX_WORKSPACENAME_WIDTH] = 0;
|
||||
|
||||
entry = wMenuAddCallback(menu, title, switchWSCommand, NULL);
|
||||
@@ -336,7 +339,7 @@ static void updateWorkspaceMenu(WMenu * menu)
|
||||
}
|
||||
|
||||
/* workspace shortcut labels */
|
||||
if (i / 10 == w_global.workspace.current / 10)
|
||||
if (i / 10 == scr->current_workspace / 10)
|
||||
entry->rtext = GetShortcutKey(wKeyBindings[WKBD_MOVE_WORKSPACE1 + (i % 10)]);
|
||||
else
|
||||
entry->rtext = NULL;
|
||||
@@ -346,7 +349,7 @@ static void updateWorkspaceMenu(WMenu * menu)
|
||||
wMenuRealize(menu);
|
||||
}
|
||||
|
||||
static void updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
||||
static void updateMakeShortcutMenu(WMenu * menu, WWindow * wwin)
|
||||
{
|
||||
WMenu *smenu = menu->cascades[menu->entries[MC_OPTIONS]->cascade];
|
||||
int i;
|
||||
@@ -363,7 +366,7 @@ static void updateMakeShortcutMenu(WMenu *menu, WWindow *wwin)
|
||||
for (i = WO_ENTRIES; i < smenu->entry_no; i++) {
|
||||
int shortcutNo = i - WO_ENTRIES;
|
||||
WMenuEntry *entry = smenu->entries[i];
|
||||
WMArray *shortSelWindows = w_global.shortcut.windows[shortcutNo];
|
||||
WMArray *shortSelWindows = wwin->screen_ptr->shortcutWindows[shortcutNo];
|
||||
|
||||
snprintf(buffer, buflen, "%s %i", _("Set Shortcut"), shortcutNo + 1);
|
||||
|
||||
@@ -478,7 +481,7 @@ static WMenu *makeWorkspaceMenu(WScreen * scr)
|
||||
return menu;
|
||||
}
|
||||
|
||||
static WMenu *makeMakeShortcutMenu(WMenu *menu)
|
||||
static WMenu *makeMakeShortcutMenu(WMenu * menu)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -562,15 +565,20 @@ static WMenu *createWindowMenu(WScreen * scr)
|
||||
entry = wMenuAddCallback(menu, _("Select"), execMenuCommand, NULL);
|
||||
|
||||
entry = wMenuAddCallback(menu, _("Move To"), NULL, NULL);
|
||||
w_global.workspace.submenu = makeWorkspaceMenu(scr);
|
||||
if (w_global.workspace.submenu)
|
||||
wMenuEntrySetCascade(menu, entry, w_global.workspace.submenu);
|
||||
scr->workspace_submenu = makeWorkspaceMenu(scr);
|
||||
if (scr->workspace_submenu)
|
||||
wMenuEntrySetCascade(menu, entry, scr->workspace_submenu);
|
||||
|
||||
entry = wMenuAddCallback(menu, _("Attributes..."), execMenuCommand, NULL);
|
||||
|
||||
entry = wMenuAddCallback(menu, _("Options"), NULL, NULL);
|
||||
wMenuEntrySetCascade(menu, entry, makeMakeShortcutMenu(makeOptionsMenu(scr)));
|
||||
|
||||
/*
|
||||
entry = wMenuAddCallback(menu, _("Select Shortcut"), NULL, NULL);
|
||||
wMenuEntrySetCascade(menu, entry, makeMakeShortcutMenu(scr));
|
||||
*/
|
||||
|
||||
entry = wMenuAddCallback(menu, _("Launch"), execMenuCommand, NULL);
|
||||
|
||||
entry = wMenuAddCallback(menu, _("Close"), execMenuCommand, NULL);
|
||||
@@ -598,6 +606,7 @@ void CloseWindowMenu(WScreen * scr)
|
||||
static void updateMenuForWindow(WMenu * menu, WWindow * wwin)
|
||||
{
|
||||
WApplication *wapp = wApplicationOf(wwin->main_window);
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
int i;
|
||||
|
||||
updateOptionsMenu(menu, wwin);
|
||||
@@ -700,13 +709,12 @@ static void updateMenuForWindow(WMenu * menu, WWindow * wwin)
|
||||
menu->entries[i]->clientdata = wwin;
|
||||
}
|
||||
|
||||
for (i = 0; i < w_global.workspace.submenu->entry_no; i++) {
|
||||
w_global.workspace.submenu->entries[i]->clientdata = wwin;
|
||||
|
||||
if (i == w_global.workspace.current)
|
||||
wMenuSetEnabled(w_global.workspace.submenu, i, False);
|
||||
for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
|
||||
scr->workspace_submenu->entries[i]->clientdata = wwin;
|
||||
if (i == scr->current_workspace)
|
||||
wMenuSetEnabled(scr->workspace_submenu, i, False);
|
||||
else
|
||||
wMenuSetEnabled(w_global.workspace.submenu, i, True);
|
||||
wMenuSetEnabled(scr->workspace_submenu, i, True);
|
||||
}
|
||||
|
||||
menu->flags.realized = 0;
|
||||
@@ -729,7 +737,7 @@ static WMenu *open_window_menu_core(WWindow *wwin)
|
||||
wfree(scr->window_menu->entries[MC_SHADE]->text);
|
||||
wfree(scr->window_menu->entries[MC_SELECT]->text);
|
||||
} else {
|
||||
updateWorkspaceMenu(w_global.workspace.submenu);
|
||||
updateWorkspaceMenu(scr->workspace_submenu);
|
||||
}
|
||||
|
||||
menu = scr->window_menu;
|
||||
@@ -782,15 +790,16 @@ void OpenWindowMenu2(WWindow *wwin, int x, int y, int keyboard)
|
||||
{
|
||||
int i;
|
||||
WMenu *menu;
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
|
||||
menu = open_window_menu_core(wwin);
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
/* Specific menu position */
|
||||
for (i = 0; i < w_global.workspace.submenu->entry_no; i++) {
|
||||
w_global.workspace.submenu->entries[i]->clientdata = wwin;
|
||||
wMenuSetEnabled(w_global.workspace.submenu, i, True);
|
||||
for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
|
||||
scr->workspace_submenu->entries[i]->clientdata = wwin;
|
||||
wMenuSetEnabled(scr->workspace_submenu, i, True);
|
||||
}
|
||||
|
||||
x -= menu->frame->core->width / 2;
|
||||
|
||||
+9
-8
@@ -499,8 +499,8 @@ static void saveSettings(WMWidget *button, void *client_data)
|
||||
}
|
||||
|
||||
i = WMGetPopUpButtonSelectedItem(panel->wsP) - 1;
|
||||
if (i >= 0 && i < w_global.workspace.count) {
|
||||
value = WMCreatePLString(w_global.workspace.array[i]->name);
|
||||
if (i >= 0 && i < panel->frame->screen_ptr->workspace_count) {
|
||||
value = WMCreatePLString(panel->frame->screen_ptr->workspaces[i]->name);
|
||||
different |= insertAttribute(dict, winDic, AStartWorkspace, value, flags);
|
||||
WMReleasePropList(value);
|
||||
}
|
||||
@@ -938,9 +938,9 @@ static void revertSettings(WMWidget *button, void *client_data)
|
||||
|
||||
showIconFor(WMWidgetScreen(panel->alwChk), panel, wm_instance, wm_class, REVERT_TO_DEFAULT);
|
||||
|
||||
n = wDefaultGetStartWorkspace(wm_instance, wm_class);
|
||||
n = wDefaultGetStartWorkspace(wwin->screen_ptr, wm_instance, wm_class);
|
||||
|
||||
if (n >= 0 && n < w_global.workspace.count)
|
||||
if (n >= 0 && n < wwin->screen_ptr->workspace_count)
|
||||
WMSetPopUpButtonSelectedItem(panel->wsP, n + 1);
|
||||
else
|
||||
WMSetPopUpButtonSelectedItem(panel->wsP, 0);
|
||||
@@ -1484,6 +1484,7 @@ static void create_tab_window_advanced(WWindow *wwin, InspectorPanel *panel, int
|
||||
|
||||
static void create_tab_icon_workspace(WWindow *wwin, InspectorPanel *panel)
|
||||
{
|
||||
WScreen *scr = wwin->screen_ptr;
|
||||
int i = 0;
|
||||
|
||||
/* miniwindow/workspace */
|
||||
@@ -1534,11 +1535,11 @@ static void create_tab_icon_workspace(WWindow *wwin, InspectorPanel *panel)
|
||||
WMResizeWidget(panel->wsP, PWIDTH - (2 * 15) - (2 * 20), 20);
|
||||
WMAddPopUpButtonItem(panel->wsP, _("Nowhere in particular"));
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++)
|
||||
WMAddPopUpButtonItem(panel->wsP, w_global.workspace.array[i]->name);
|
||||
for (i = 0; i < wwin->screen_ptr->workspace_count; i++)
|
||||
WMAddPopUpButtonItem(panel->wsP, scr->workspaces[i]->name);
|
||||
|
||||
i = wDefaultGetStartWorkspace(wwin->wm_instance, wwin->wm_class);
|
||||
if (i >= 0 && i <= w_global.workspace.count)
|
||||
i = wDefaultGetStartWorkspace(wwin->screen_ptr, wwin->wm_instance, wwin->wm_class);
|
||||
if (i >= 0 && i <= wwin->screen_ptr->workspace_count)
|
||||
WMSetPopUpButtonSelectedItem(panel->wsP, i + 1);
|
||||
else
|
||||
WMSetPopUpButtonSelectedItem(panel->wsP, 0);
|
||||
|
||||
+18
-18
@@ -337,15 +337,15 @@ void wNETWMUpdateDesktop(WScreen *scr)
|
||||
long *views, sizes[2];
|
||||
int count, i;
|
||||
|
||||
if (w_global.workspace.count == 0)
|
||||
if (scr->workspace_count == 0)
|
||||
return;
|
||||
|
||||
count = w_global.workspace.count * 2;
|
||||
count = scr->workspace_count * 2;
|
||||
views = wmalloc(sizeof(long) * count);
|
||||
sizes[0] = scr->scr_width;
|
||||
sizes[1] = scr->scr_height;
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
views[2 * i + 0] = 0;
|
||||
views[2 * i + 1] = 0;
|
||||
}
|
||||
@@ -558,13 +558,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 = w_global.workspace.current;
|
||||
int ws = scr->current_workspace;
|
||||
WWindow **tmp;
|
||||
for (tmp = scr->netdata->show_desktop; *tmp; ++tmp) {
|
||||
wDeiconifyWindow(*tmp);
|
||||
(*tmp)->flags.net_show_desktop = 0;
|
||||
}
|
||||
if (ws != w_global.workspace.current)
|
||||
if (ws != scr->current_workspace)
|
||||
wWorkspaceChange(scr, ws);
|
||||
wfree(scr->netdata->show_desktop);
|
||||
scr->netdata->show_desktop = NULL;
|
||||
@@ -689,13 +689,13 @@ void wNETWMUpdateWorkarea(WScreen *scr)
|
||||
long *area;
|
||||
int count, i;
|
||||
|
||||
if (!scr->netdata || w_global.workspace.count == 0 || !scr->usableArea)
|
||||
if (!scr->netdata || scr->workspace_count == 0 || !scr->usableArea)
|
||||
return;
|
||||
|
||||
count = w_global.workspace.count * 4;
|
||||
count = scr->workspace_count * 4;
|
||||
area = wmalloc(sizeof(long) * count);
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
area[4 * i + 0] = scr->usableArea[0].x1;
|
||||
area[4 * i + 1] = scr->usableArea[0].y1;
|
||||
area[4 * i + 2] = scr->usableArea[0].x2 - scr->usableArea[0].x1;
|
||||
@@ -808,7 +808,7 @@ static void updateWorkspaceCount(WScreen *scr)
|
||||
{ /* changeable */
|
||||
long count;
|
||||
|
||||
count = w_global.workspace.count;
|
||||
count = scr->workspace_count;
|
||||
|
||||
XChangeProperty(dpy, scr->root_win, net_number_of_desktops, XA_CARDINAL,
|
||||
32, PropModeReplace, (unsigned char *)&count, 1);
|
||||
@@ -818,7 +818,7 @@ static void updateCurrentWorkspace(WScreen *scr)
|
||||
{ /* changeable */
|
||||
long count;
|
||||
|
||||
count = w_global.workspace.current;
|
||||
count = scr->current_workspace;
|
||||
|
||||
XChangeProperty(dpy, scr->root_win, net_current_desktop, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)&count, 1);
|
||||
@@ -831,9 +831,9 @@ static void updateWorkspaceNames(WScreen *scr)
|
||||
|
||||
pos = buf;
|
||||
len = 0;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
curr_size = strlen(w_global.workspace.array[i]->name);
|
||||
strcpy(pos, w_global.workspace.array[i]->name);
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
curr_size = strlen(scr->workspaces[i]->name);
|
||||
strcpy(pos, scr->workspaces[i]->name);
|
||||
pos += (curr_size + 1);
|
||||
len += (curr_size + 1);
|
||||
}
|
||||
@@ -1489,13 +1489,13 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
|
||||
long value;
|
||||
|
||||
value = event->data.l[0];
|
||||
if (value > w_global.workspace.count) {
|
||||
wWorkspaceMake(scr, value - w_global.workspace.count);
|
||||
} else if (value < w_global.workspace.count) {
|
||||
if (value > scr->workspace_count) {
|
||||
wWorkspaceMake(scr, value - scr->workspace_count);
|
||||
} else if (value < scr->workspace_count) {
|
||||
int i;
|
||||
Bool rebuild = False;
|
||||
|
||||
for (i = w_global.workspace.count - 1; i >= value; i--) {
|
||||
for (i = scr->workspace_count - 1; i >= value; i--) {
|
||||
if (!wWorkspaceDelete(scr, i)) {
|
||||
rebuild = True;
|
||||
break;
|
||||
@@ -1531,7 +1531,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 == w_global.workspace.current /* No workspace change */
|
||||
if (wwin->frame->workspace == wwin->screen_ptr->current_workspace /* No workspace change */
|
||||
|| event->data.l[0] == 2 /* Requested by pager */
|
||||
|| WFLAGP(wwin, focus_across_wksp) /* Explicitly allowed */) {
|
||||
wNETWMShowingDesktop(scr, False);
|
||||
|
||||
+121
-122
@@ -59,7 +59,6 @@
|
||||
#define MAX_SHORTCUT_LENGTH 32
|
||||
#define WORKSPACE_NAME_DISPLAY_PADDING 32
|
||||
|
||||
|
||||
static WMPropList *dWorkspaces = NULL;
|
||||
static WMPropList *dClip, *dName;
|
||||
|
||||
@@ -86,8 +85,8 @@ int wWorkspaceNew(WScreen *scr)
|
||||
WWorkspace *wspace, **list;
|
||||
int i;
|
||||
|
||||
if (w_global.workspace.count < MAX_WORKSPACES) {
|
||||
w_global.workspace.count++;
|
||||
if (scr->workspace_count < MAX_WORKSPACES) {
|
||||
scr->workspace_count++;
|
||||
|
||||
wspace = wmalloc(sizeof(WWorkspace));
|
||||
wspace->name = NULL;
|
||||
@@ -102,30 +101,30 @@ int wWorkspaceNew(WScreen *scr)
|
||||
name_length = strlen(new_name) + 8;
|
||||
}
|
||||
wspace->name = wmalloc(name_length);
|
||||
snprintf(wspace->name, name_length, new_name, w_global.workspace.count);
|
||||
snprintf(wspace->name, name_length, new_name, scr->workspace_count);
|
||||
}
|
||||
|
||||
if (!wPreferences.flags.noclip)
|
||||
wspace->clip = wDockCreate(scr, WM_CLIP, NULL);
|
||||
|
||||
list = wmalloc(sizeof(WWorkspace *) * w_global.workspace.count);
|
||||
list = wmalloc(sizeof(WWorkspace *) * scr->workspace_count);
|
||||
|
||||
for (i = 0; i < w_global.workspace.count - 1; i++)
|
||||
list[i] = w_global.workspace.array[i];
|
||||
for (i = 0; i < scr->workspace_count - 1; i++)
|
||||
list[i] = scr->workspaces[i];
|
||||
|
||||
list[i] = wspace;
|
||||
if (w_global.workspace.array)
|
||||
wfree(w_global.workspace.array);
|
||||
if (scr->workspaces)
|
||||
wfree(scr->workspaces);
|
||||
|
||||
w_global.workspace.array = list;
|
||||
scr->workspaces = list;
|
||||
|
||||
wWorkspaceMenuUpdate(w_global.workspace.menu);
|
||||
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||
wNETWMUpdateDesktop(scr);
|
||||
WMPostNotificationName(WMNWorkspaceCreated, scr, (void *)(uintptr_t) (w_global.workspace.count - 1));
|
||||
WMPostNotificationName(WMNWorkspaceCreated, scr, (void *)(uintptr_t) (scr->workspace_count - 1));
|
||||
XFlush(dpy);
|
||||
|
||||
return w_global.workspace.count - 1;
|
||||
return scr->workspace_count - 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -149,56 +148,56 @@ Bool wWorkspaceDelete(WScreen * scr, int workspace)
|
||||
}
|
||||
|
||||
if (!wPreferences.flags.noclip) {
|
||||
wDockDestroy(w_global.workspace.array[workspace]->clip);
|
||||
w_global.workspace.array[workspace]->clip = NULL;
|
||||
wDockDestroy(scr->workspaces[workspace]->clip);
|
||||
scr->workspaces[workspace]->clip = NULL;
|
||||
}
|
||||
|
||||
list = wmalloc(sizeof(WWorkspace *) * (w_global.workspace.count - 1));
|
||||
list = wmalloc(sizeof(WWorkspace *) * (scr->workspace_count - 1));
|
||||
j = 0;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (i != workspace) {
|
||||
list[j++] = w_global.workspace.array[i];
|
||||
list[j++] = scr->workspaces[i];
|
||||
} else {
|
||||
if (w_global.workspace.array[i]->name)
|
||||
wfree(w_global.workspace.array[i]->name);
|
||||
wfree(w_global.workspace.array[i]);
|
||||
if (scr->workspaces[i]->name)
|
||||
wfree(scr->workspaces[i]->name);
|
||||
wfree(scr->workspaces[i]);
|
||||
}
|
||||
}
|
||||
wfree(w_global.workspace.array);
|
||||
w_global.workspace.array = list;
|
||||
wfree(scr->workspaces);
|
||||
scr->workspaces = list;
|
||||
|
||||
w_global.workspace.count--;
|
||||
scr->workspace_count--;
|
||||
|
||||
/* update menu */
|
||||
wWorkspaceMenuUpdate(w_global.workspace.menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
|
||||
/* clip workspace menu */
|
||||
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||
|
||||
/* update also window menu */
|
||||
if (w_global.workspace.submenu) {
|
||||
WMenu *menu = w_global.workspace.submenu;
|
||||
if (scr->workspace_submenu) {
|
||||
WMenu *menu = scr->workspace_submenu;
|
||||
|
||||
i = menu->entry_no;
|
||||
while (i > w_global.workspace.count)
|
||||
while (i > scr->workspace_count)
|
||||
wMenuRemoveItem(menu, --i);
|
||||
wMenuRealize(menu);
|
||||
}
|
||||
/* and clip menu */
|
||||
if (w_global.clip.submenu) {
|
||||
WMenu *menu = w_global.clip.submenu;
|
||||
if (scr->clip_submenu) {
|
||||
WMenu *menu = scr->clip_submenu;
|
||||
|
||||
i = menu->entry_no;
|
||||
while (i > w_global.workspace.count)
|
||||
while (i > scr->workspace_count)
|
||||
wMenuRemoveItem(menu, --i);
|
||||
wMenuRealize(menu);
|
||||
}
|
||||
wNETWMUpdateDesktop(scr);
|
||||
WMPostNotificationName(WMNWorkspaceDestroyed, scr, (void *)(uintptr_t) (w_global.workspace.count - 1));
|
||||
WMPostNotificationName(WMNWorkspaceDestroyed, scr, (void *)(uintptr_t) (scr->workspace_count - 1));
|
||||
|
||||
if (w_global.workspace.current >= w_global.workspace.count)
|
||||
wWorkspaceChange(scr, w_global.workspace.count - 1);
|
||||
if (w_global.workspace.last_used >= w_global.workspace.count)
|
||||
w_global.workspace.last_used = 0;
|
||||
if (scr->current_workspace >= scr->workspace_count)
|
||||
wWorkspaceChange(scr, scr->workspace_count - 1);
|
||||
if (scr->last_workspace >= scr->workspace_count)
|
||||
scr->last_workspace = 0;
|
||||
|
||||
return True;
|
||||
}
|
||||
@@ -255,7 +254,7 @@ static void showWorkspaceName(WScreen * scr, int workspace)
|
||||
Pixmap text, mask;
|
||||
int w, h;
|
||||
int px, py;
|
||||
char *name = w_global.workspace.array[workspace]->name;
|
||||
char *name = scr->workspaces[workspace]->name;
|
||||
int len = strlen(name);
|
||||
int x, y;
|
||||
#ifdef USE_XINERAMA
|
||||
@@ -264,7 +263,7 @@ static void showWorkspaceName(WScreen * scr, int workspace)
|
||||
int xx, yy;
|
||||
#endif
|
||||
|
||||
if (wPreferences.workspace_name_display_position == WD_NONE || w_global.workspace.count < 2)
|
||||
if (wPreferences.workspace_name_display_position == WD_NONE || scr->workspace_count < 2)
|
||||
return;
|
||||
|
||||
if (scr->workspace_name_timer) {
|
||||
@@ -283,8 +282,8 @@ static void showWorkspaceName(WScreen * scr, int workspace)
|
||||
data = wmalloc(sizeof(WorkspaceNameData));
|
||||
data->back = NULL;
|
||||
|
||||
w = WMWidthOfString(w_global.workspace.font_for_name, name, len);
|
||||
h = WMFontHeight(w_global.workspace.font_for_name);
|
||||
w = WMWidthOfString(scr->workspace_name_font, name, len);
|
||||
h = WMFontHeight(scr->workspace_name_font);
|
||||
|
||||
#ifdef USE_XINERAMA
|
||||
head = wGetHeadForPointerLocation(scr);
|
||||
@@ -356,7 +355,7 @@ static void showWorkspaceName(WScreen * scr, int workspace)
|
||||
|
||||
for (x = 0; x <= 4; x++)
|
||||
for (y = 0; y <= 4; y++)
|
||||
WMDrawString(scr->wmscreen, text, scr->white, w_global.workspace.font_for_name, x, y, name, len);
|
||||
WMDrawString(scr->wmscreen, text, scr->white, scr->workspace_name_font, x, y, name, len);
|
||||
|
||||
XSetForeground(dpy, scr->mono_gc, 1);
|
||||
XSetBackground(dpy, scr->mono_gc, 0);
|
||||
@@ -368,7 +367,7 @@ static void showWorkspaceName(WScreen * scr, int workspace)
|
||||
|
||||
XFillRectangle(dpy, text, WMColorGC(scr->black), 0, 0, w + 4, h + 4);
|
||||
|
||||
WMDrawString(scr->wmscreen, text, scr->white, w_global.workspace.font_for_name, 2, 2, name, len);
|
||||
WMDrawString(scr->wmscreen, text, scr->white, scr->workspace_name_font, 2, 2, name, len);
|
||||
|
||||
#ifdef USE_XSHAPE
|
||||
if (w_global.xext.shape.supported)
|
||||
@@ -433,7 +432,7 @@ void wWorkspaceChange(WScreen *scr, int workspace)
|
||||
if (scr->flags.startup || scr->flags.startup2 || scr->flags.ignore_focus_events)
|
||||
return;
|
||||
|
||||
if (workspace != w_global.workspace.current)
|
||||
if (workspace != scr->current_workspace)
|
||||
wWorkspaceForceChange(scr, workspace);
|
||||
}
|
||||
|
||||
@@ -445,24 +444,24 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount)
|
||||
* still "flying" to its final position and we don't want to
|
||||
* change workspace before the animation finishes, otherwise
|
||||
* the window will land in the new workspace */
|
||||
if (w_global.workspace.ignore_change)
|
||||
if (w_global.ignore_workspace_change)
|
||||
return;
|
||||
|
||||
w = w_global.workspace.current + amount;
|
||||
w = scr->current_workspace + amount;
|
||||
|
||||
if (amount < 0) {
|
||||
if (w >= 0) {
|
||||
wWorkspaceChange(scr, w);
|
||||
} else if (wPreferences.ws_cycle) {
|
||||
wWorkspaceChange(scr, w_global.workspace.count + w);
|
||||
wWorkspaceChange(scr, scr->workspace_count + w);
|
||||
}
|
||||
} else if (amount > 0) {
|
||||
if (w < w_global.workspace.count) {
|
||||
if (w < scr->workspace_count) {
|
||||
wWorkspaceChange(scr, w);
|
||||
} else if (wPreferences.ws_advance) {
|
||||
wWorkspaceChange(scr, WMIN(w, MAX_WORKSPACES - 1));
|
||||
} else if (wPreferences.ws_cycle) {
|
||||
wWorkspaceChange(scr, w % w_global.workspace.count);
|
||||
wWorkspaceChange(scr, w % scr->workspace_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,17 +475,17 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
|
||||
|
||||
SendHelperMessage(scr, 'C', workspace + 1, NULL);
|
||||
|
||||
if (workspace > w_global.workspace.count - 1)
|
||||
wWorkspaceMake(scr, workspace - w_global.workspace.count + 1);
|
||||
if (workspace > scr->workspace_count - 1)
|
||||
wWorkspaceMake(scr, workspace - scr->workspace_count + 1);
|
||||
|
||||
wClipUpdateForWorkspaceChange(scr, workspace);
|
||||
|
||||
w_global.workspace.last_used = w_global.workspace.current;
|
||||
w_global.workspace.current = workspace;
|
||||
scr->last_workspace = scr->current_workspace;
|
||||
scr->current_workspace = workspace;
|
||||
|
||||
wWorkspaceMenuUpdate(w_global.workspace.menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
|
||||
|
||||
wWorkspaceMenuUpdate(w_global.clip.ws_menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||
|
||||
if ((tmp = scr->focused_window) != NULL) {
|
||||
WWindow **toUnmap;
|
||||
@@ -622,14 +621,14 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
|
||||
if (scr->dock)
|
||||
wAppIconPaint(scr->dock->icon_array[0]);
|
||||
|
||||
if (!wPreferences.flags.noclip && (w_global.workspace.array[workspace]->clip->auto_collapse ||
|
||||
w_global.workspace.array[workspace]->clip->auto_raise_lower)) {
|
||||
if (!wPreferences.flags.noclip && (scr->workspaces[workspace]->clip->auto_collapse ||
|
||||
scr->workspaces[workspace]->clip->auto_raise_lower)) {
|
||||
/* to handle enter notify. This will also */
|
||||
XUnmapWindow(dpy, w_global.clip.icon->icon->core->window);
|
||||
XMapWindow(dpy, w_global.clip.icon->icon->core->window);
|
||||
XUnmapWindow(dpy, scr->clip_icon->icon->core->window);
|
||||
XMapWindow(dpy, scr->clip_icon->icon->core->window);
|
||||
}
|
||||
else if (w_global.clip.icon != NULL) {
|
||||
wClipIconPaint();
|
||||
else if (scr->clip_icon != NULL) {
|
||||
wClipIconPaint(scr->clip_icon);
|
||||
}
|
||||
wScreenUpdateUsableArea(scr);
|
||||
wNETWMUpdateDesktop(scr);
|
||||
@@ -650,7 +649,7 @@ static void lastWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
/* Parameter not used, but tell the compiler that it is ok */
|
||||
(void) entry;
|
||||
|
||||
wWorkspaceChange(menu->frame->screen_ptr, w_global.workspace.last_used);
|
||||
wWorkspaceChange(menu->frame->screen_ptr, menu->frame->screen_ptr->last_workspace);
|
||||
}
|
||||
|
||||
static void deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
@@ -658,7 +657,7 @@ static void deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||
/* Parameter not used, but tell the compiler that it is ok */
|
||||
(void) entry;
|
||||
|
||||
wWorkspaceDelete(menu->frame->screen_ptr, w_global.workspace.count - 1);
|
||||
wWorkspaceDelete(menu->frame->screen_ptr, menu->frame->screen_ptr->workspace_count - 1);
|
||||
}
|
||||
|
||||
static void newWSCommand(WMenu *menu, WMenuEntry *foo)
|
||||
@@ -680,7 +679,7 @@ void wWorkspaceRename(WScreen *scr, int workspace, const char *name)
|
||||
char buf[MAX_WORKSPACENAME_WIDTH + 1];
|
||||
char *tmp;
|
||||
|
||||
if (workspace >= w_global.workspace.count)
|
||||
if (workspace >= scr->workspace_count)
|
||||
return;
|
||||
|
||||
/* trim white spaces */
|
||||
@@ -695,26 +694,26 @@ void wWorkspaceRename(WScreen *scr, int workspace, const char *name)
|
||||
wfree(tmp);
|
||||
|
||||
/* update workspace */
|
||||
wfree(w_global.workspace.array[workspace]->name);
|
||||
w_global.workspace.array[workspace]->name = wstrdup(buf);
|
||||
wfree(scr->workspaces[workspace]->name);
|
||||
scr->workspaces[workspace]->name = wstrdup(buf);
|
||||
|
||||
if (w_global.clip.ws_menu) {
|
||||
if (strcmp(w_global.clip.ws_menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
|
||||
wfree(w_global.clip.ws_menu->entries[workspace + MC_WORKSPACE1]->text);
|
||||
w_global.clip.ws_menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
|
||||
wMenuRealize(w_global.clip.ws_menu);
|
||||
if (scr->clip_ws_menu) {
|
||||
if (strcmp(scr->clip_ws_menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
|
||||
wfree(scr->clip_ws_menu->entries[workspace + MC_WORKSPACE1]->text);
|
||||
scr->clip_ws_menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
|
||||
wMenuRealize(scr->clip_ws_menu);
|
||||
}
|
||||
}
|
||||
if (w_global.workspace.menu) {
|
||||
if (strcmp(w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
|
||||
wfree(w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text);
|
||||
w_global.workspace.menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
|
||||
wMenuRealize(w_global.workspace.menu);
|
||||
if (scr->workspace_menu) {
|
||||
if (strcmp(scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text, buf) != 0) {
|
||||
wfree(scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text);
|
||||
scr->workspace_menu->entries[workspace + MC_WORKSPACE1]->text = wstrdup(buf);
|
||||
wMenuRealize(scr->workspace_menu);
|
||||
}
|
||||
}
|
||||
|
||||
if (w_global.clip.icon)
|
||||
wClipIconPaint();
|
||||
if (scr->clip_icon)
|
||||
wClipIconPaint(scr->clip_icon);
|
||||
|
||||
WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void *)(uintptr_t) workspace);
|
||||
}
|
||||
@@ -751,7 +750,7 @@ WMenu *wWorkspaceMenuMake(WScreen * scr, Bool titled)
|
||||
return wsmenu;
|
||||
}
|
||||
|
||||
void wWorkspaceMenuUpdate(WMenu *menu)
|
||||
void wWorkspaceMenuUpdate(WScreen * scr, WMenu * menu)
|
||||
{
|
||||
int i;
|
||||
long ws;
|
||||
@@ -762,12 +761,12 @@ void wWorkspaceMenuUpdate(WMenu *menu)
|
||||
if (!menu)
|
||||
return;
|
||||
|
||||
if (menu->entry_no < w_global.workspace.count + MC_WORKSPACE1) {
|
||||
if (menu->entry_no < scr->workspace_count + MC_WORKSPACE1) {
|
||||
/* new workspace(s) added */
|
||||
i = w_global.workspace.count - (menu->entry_no - MC_WORKSPACE1);
|
||||
i = scr->workspace_count - (menu->entry_no - MC_WORKSPACE1);
|
||||
ws = menu->entry_no - MC_WORKSPACE1;
|
||||
while (i > 0) {
|
||||
wstrlcpy(title, w_global.workspace.array[ws]->name, MAX_WORKSPACENAME_WIDTH);
|
||||
wstrlcpy(title, scr->workspaces[ws]->name, MAX_WORKSPACENAME_WIDTH);
|
||||
|
||||
entry = wMenuAddCallback(menu, title, switchWSCommand, (void *)ws);
|
||||
entry->flags.indicator = 1;
|
||||
@@ -776,32 +775,32 @@ void wWorkspaceMenuUpdate(WMenu *menu)
|
||||
i--;
|
||||
ws++;
|
||||
}
|
||||
} else if (menu->entry_no > w_global.workspace.count + MC_WORKSPACE1) {
|
||||
} else if (menu->entry_no > scr->workspace_count + MC_WORKSPACE1) {
|
||||
/* removed workspace(s) */
|
||||
for (i = menu->entry_no - 1; i >= w_global.workspace.count + MC_WORKSPACE1; i--)
|
||||
for (i = menu->entry_no - 1; i >= scr->workspace_count + MC_WORKSPACE1; i--)
|
||||
wMenuRemoveItem(menu, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
/* workspace shortcut labels */
|
||||
if (i / 10 == w_global.workspace.current / 10)
|
||||
if (i / 10 == scr->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[w_global.workspace.current + MC_WORKSPACE1]->flags.indicator_on = 1;
|
||||
menu->entries[scr->current_workspace + MC_WORKSPACE1]->flags.indicator_on = 1;
|
||||
wMenuRealize(menu);
|
||||
|
||||
/* don't let user destroy current workspace */
|
||||
if (w_global.workspace.current == w_global.workspace.count - 1)
|
||||
if (scr->current_workspace == scr->workspace_count - 1)
|
||||
wMenuSetEnabled(menu, MC_DESTROY_LAST, False);
|
||||
else
|
||||
wMenuSetEnabled(menu, MC_DESTROY_LAST, True);
|
||||
|
||||
/* back to last workspace */
|
||||
if (w_global.workspace.count && w_global.workspace.last_used != w_global.workspace.current)
|
||||
if (scr->workspace_count && scr->last_workspace != scr->current_workspace)
|
||||
wMenuSetEnabled(menu, MC_LAST_USED, True);
|
||||
else
|
||||
wMenuSetEnabled(menu, MC_LAST_USED, False);
|
||||
@@ -814,7 +813,7 @@ void wWorkspaceMenuUpdate(WMenu *menu)
|
||||
wMenuPaint(menu);
|
||||
}
|
||||
|
||||
void wWorkspaceSaveState(WMPropList * old_state)
|
||||
void wWorkspaceSaveState(WScreen * scr, WMPropList * old_state)
|
||||
{
|
||||
WMPropList *parr, *pstr, *wks_state, *old_wks_state, *foo, *bar;
|
||||
int i;
|
||||
@@ -823,12 +822,12 @@ void wWorkspaceSaveState(WMPropList * old_state)
|
||||
|
||||
old_wks_state = WMGetFromPLDictionary(old_state, dWorkspaces);
|
||||
parr = WMCreatePLArray(NULL);
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
pstr = WMCreatePLString(w_global.workspace.array[i]->name);
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
pstr = WMCreatePLString(scr->workspaces[i]->name);
|
||||
wks_state = WMCreatePLDictionary(dName, pstr, NULL);
|
||||
WMReleasePropList(pstr);
|
||||
if (!wPreferences.flags.noclip) {
|
||||
pstr = wClipSaveWorkspaceState(i);
|
||||
pstr = wClipSaveWorkspaceState(scr, i);
|
||||
WMPutInPLDictionary(wks_state, dClip, pstr);
|
||||
WMReleasePropList(pstr);
|
||||
} else if (old_wks_state != NULL) {
|
||||
@@ -841,7 +840,7 @@ void wWorkspaceSaveState(WMPropList * old_state)
|
||||
WMAddToPLArray(parr, wks_state);
|
||||
WMReleasePropList(wks_state);
|
||||
}
|
||||
WMPutInPLDictionary(w_global.session_state, dWorkspaces, parr);
|
||||
WMPutInPLDictionary(scr->session_state, dWorkspaces, parr);
|
||||
WMReleasePropList(parr);
|
||||
}
|
||||
|
||||
@@ -852,10 +851,10 @@ void wWorkspaceRestoreState(WScreen *scr)
|
||||
|
||||
make_keys();
|
||||
|
||||
if (w_global.session_state == NULL)
|
||||
if (scr->session_state == NULL)
|
||||
return;
|
||||
|
||||
parr = WMGetFromPLDictionary(w_global.session_state, dWorkspaces);
|
||||
parr = WMGetFromPLDictionary(scr->session_state, dWorkspaces);
|
||||
|
||||
if (!parr)
|
||||
return;
|
||||
@@ -867,35 +866,35 @@ void wWorkspaceRestoreState(WScreen *scr)
|
||||
else
|
||||
pstr = wks_state;
|
||||
|
||||
if (i >= w_global.workspace.count)
|
||||
if (i >= scr->workspace_count)
|
||||
wWorkspaceNew(scr);
|
||||
|
||||
if (w_global.workspace.menu) {
|
||||
wfree(w_global.workspace.menu->entries[i + MC_WORKSPACE1]->text);
|
||||
w_global.workspace.menu->entries[i + MC_WORKSPACE1]->text = wstrdup(WMGetFromPLString(pstr));
|
||||
w_global.workspace.menu->flags.realized = 0;
|
||||
if (scr->workspace_menu) {
|
||||
wfree(scr->workspace_menu->entries[i + MC_WORKSPACE1]->text);
|
||||
scr->workspace_menu->entries[i + MC_WORKSPACE1]->text = wstrdup(WMGetFromPLString(pstr));
|
||||
scr->workspace_menu->flags.realized = 0;
|
||||
}
|
||||
|
||||
wfree(w_global.workspace.array[i]->name);
|
||||
w_global.workspace.array[i]->name = wstrdup(WMGetFromPLString(pstr));
|
||||
wfree(scr->workspaces[i]->name);
|
||||
scr->workspaces[i]->name = wstrdup(WMGetFromPLString(pstr));
|
||||
if (!wPreferences.flags.noclip) {
|
||||
int added_omnipresent_icons = 0;
|
||||
|
||||
clip_state = WMGetFromPLDictionary(wks_state, dClip);
|
||||
if (w_global.workspace.array[i]->clip)
|
||||
wDockDestroy(w_global.workspace.array[i]->clip);
|
||||
if (scr->workspaces[i]->clip)
|
||||
wDockDestroy(scr->workspaces[i]->clip);
|
||||
|
||||
w_global.workspace.array[i]->clip = wDockRestoreState(scr, clip_state, WM_CLIP);
|
||||
scr->workspaces[i]->clip = wDockRestoreState(scr, clip_state, WM_CLIP);
|
||||
if (i > 0)
|
||||
wDockHideIcons(w_global.workspace.array[i]->clip);
|
||||
wDockHideIcons(scr->workspaces[i]->clip);
|
||||
|
||||
/* We set the global icons here, because scr->workspaces[i]->clip
|
||||
* was not valid in wDockRestoreState().
|
||||
* There we only set icon->omnipresent to know which icons we
|
||||
* need to set here.
|
||||
*/
|
||||
for (j = 0; j < w_global.workspace.array[i]->clip->max_icons; j++) {
|
||||
WAppIcon *aicon = w_global.workspace.array[i]->clip->icon_array[j];
|
||||
for (j = 0; j < scr->workspaces[i]->clip->max_icons; j++) {
|
||||
WAppIcon *aicon = scr->workspaces[i]->clip->icon_array[j];
|
||||
int k;
|
||||
|
||||
if (!aicon || !aicon->omnipresent)
|
||||
@@ -907,21 +906,21 @@ void wWorkspaceRestoreState(WScreen *scr)
|
||||
continue;
|
||||
|
||||
/* Move this appicon from workspace i to workspace 0 */
|
||||
w_global.workspace.array[i]->clip->icon_array[j] = NULL;
|
||||
w_global.workspace.array[i]->clip->icon_count--;
|
||||
scr->workspaces[i]->clip->icon_array[j] = NULL;
|
||||
scr->workspaces[i]->clip->icon_count--;
|
||||
|
||||
added_omnipresent_icons++;
|
||||
/* If there are too many omnipresent appicons, we are in trouble */
|
||||
assert(w_global.workspace.array[0]->clip->icon_count + added_omnipresent_icons
|
||||
<= w_global.workspace.array[0]->clip->max_icons);
|
||||
assert(scr->workspaces[0]->clip->icon_count + added_omnipresent_icons
|
||||
<= scr->workspaces[0]->clip->max_icons);
|
||||
/* Find first free spot on workspace 0 */
|
||||
for (k = 0; k < w_global.workspace.array[0]->clip->max_icons; k++)
|
||||
if (w_global.workspace.array[0]->clip->icon_array[k] == NULL)
|
||||
for (k = 0; k < scr->workspaces[0]->clip->max_icons; k++)
|
||||
if (scr->workspaces[0]->clip->icon_array[k] == NULL)
|
||||
break;
|
||||
w_global.workspace.array[0]->clip->icon_array[k] = aicon;
|
||||
aicon->dock = w_global.workspace.array[0]->clip;
|
||||
scr->workspaces[0]->clip->icon_array[k] = aicon;
|
||||
aicon->dock = scr->workspaces[0]->clip;
|
||||
}
|
||||
w_global.workspace.array[0]->clip->icon_count += added_omnipresent_icons;
|
||||
scr->workspaces[0]->clip->icon_count += added_omnipresent_icons;
|
||||
}
|
||||
|
||||
WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void *)(uintptr_t) i);
|
||||
@@ -929,14 +928,14 @@ void wWorkspaceRestoreState(WScreen *scr)
|
||||
}
|
||||
|
||||
/* Returns the workspace number for a given workspace name */
|
||||
int wGetWorkspaceNumber(const char *value)
|
||||
int wGetWorkspaceNumber(WScreen *scr, const char *value)
|
||||
{
|
||||
int w, i;
|
||||
|
||||
if (sscanf(value, "%i", &w) != 1) {
|
||||
w = -1;
|
||||
for (i = 0; i < w_global.workspace.count; i++) {
|
||||
if (strcmp(w_global.workspace.array[i]->name, value) == 0) {
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
if (strcmp(scr->workspaces[i]->name, value) == 0) {
|
||||
w = i;
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-3
@@ -31,14 +31,14 @@ typedef struct WWorkspace {
|
||||
|
||||
void wWorkspaceMake(WScreen *scr, int count);
|
||||
int wWorkspaceNew(WScreen *scr);
|
||||
int wGetWorkspaceNumber(const char *value);
|
||||
int wGetWorkspaceNumber(WScreen *scr, const char *value);
|
||||
Bool wWorkspaceDelete(WScreen *scr, int workspace);
|
||||
void wWorkspaceChange(WScreen *scr, int workspace);
|
||||
void wWorkspaceForceChange(WScreen *scr, int workspace);
|
||||
WMenu *wWorkspaceMenuMake(WScreen *scr, Bool titled);
|
||||
void wWorkspaceMenuUpdate(WMenu *menu);
|
||||
void wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu);
|
||||
void wWorkspaceMenuEdit(WScreen *scr);
|
||||
void wWorkspaceSaveState(WMPropList *old_state);
|
||||
void wWorkspaceSaveState(WScreen *scr, WMPropList *old_state);
|
||||
void wWorkspaceRestoreState(WScreen *scr);
|
||||
void wWorkspaceRename(WScreen *scr, int workspace, const char *name);
|
||||
void wWorkspaceRelativeChange(WScreen *scr, int amount);
|
||||
|
||||
+1
-1
@@ -213,7 +213,7 @@ static Bool acceptXDND(Window window)
|
||||
}
|
||||
}
|
||||
if (icon_pos < 0) {
|
||||
dock = w_global.workspace.array[w_global.workspace.current]->clip;
|
||||
dock = scr->workspaces[scr->current_workspace]->clip;
|
||||
if (dock) {
|
||||
for (i = 0; i < dock->max_icons; i++) {
|
||||
if (dock->icon_array[i]
|
||||
|
||||
Reference in New Issue
Block a user