mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Remove VIRTUAL_DESKTOP code
Even the option to enable "virtual desktop" in configure.ac was commented out...and I would never intend to use it anyway. So let's just remove the ~800 lines of #ifdef'ed code to have a cleaner code base to read when bored.
This commit is contained in:
@@ -113,12 +113,6 @@ static char *keyOptions[] = {
|
||||
"WindowShortcut9Key",
|
||||
"WindowShortcut10Key",
|
||||
"ScreenSwitchKey",
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
"VirtualEdgeLeftKey",
|
||||
"VirtualEdgeRightKey",
|
||||
"VirtualEdgeUpKey",
|
||||
"VirtualEdgeDownKey",
|
||||
#endif
|
||||
"DockRaiseLowerKey",
|
||||
#ifndef XKB_MODELOCK
|
||||
"ClipRaiseLowerKey"
|
||||
@@ -518,12 +512,6 @@ static void createPanel(Panel * p)
|
||||
WMAddListItem(panel->actLs, _("Shortcut for window 9"));
|
||||
WMAddListItem(panel->actLs, _("Shortcut for window 10"));
|
||||
WMAddListItem(panel->actLs, _("Switch to Next Screen/Monitor"));
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next left edge"));
|
||||
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next right edge"));
|
||||
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next top edge"));
|
||||
WMAddListItem(panel->actLs, _("Move VirtualDesktop to next bottom edge"));
|
||||
#endif
|
||||
WMAddListItem(panel->actLs, _("Raise/Lower Dock"));
|
||||
WMAddListItem(panel->actLs, _("Raise/Lower Clip"));
|
||||
#ifdef XKB_MODELOCK
|
||||
|
||||
10
configure.ac
10
configure.ac
@@ -373,16 +373,6 @@ AC_SUBST(supported_locales)
|
||||
dnl Support for various hint things
|
||||
dnl ===============================
|
||||
|
||||
dnl vdesktop_on="no"
|
||||
|
||||
dnl AC_ARG_ENABLE(vdesktop,
|
||||
dnl [ --enable-vdesktop enable virtual desktop],
|
||||
dnl [if test x$enableval = xyes; then
|
||||
dnl AC_DEFINE(VIRTUAL_DESKTOP, 1, [define if you want virtual desktop support])
|
||||
dnl vdesktop_on=yes
|
||||
dnl fi])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Beautify compilation messages
|
||||
dnl ---------------------------------------------
|
||||
|
||||
@@ -319,16 +319,11 @@ typedef struct WCoord {
|
||||
} WCoord;
|
||||
|
||||
typedef struct WPreferences {
|
||||
char *pixmap_path; /* : separate list of */
|
||||
/* paths to find pixmaps */
|
||||
char *icon_path; /* : separated list of */
|
||||
/* paths to find icons */
|
||||
char *pixmap_path; /* : separated list of paths to find pixmaps */
|
||||
char *icon_path; /* : separated list of paths to find icons */
|
||||
WMArray *fallbackWMs; /* fallback window manager list */
|
||||
|
||||
char *logger_shell; /* shell to log child stdi/o */
|
||||
|
||||
RImage *button_images; /* titlebar button images */
|
||||
|
||||
char smooth_workspace_back;
|
||||
signed char size_display; /* display type for resize geometry */
|
||||
signed char move_display; /* display type for move geometry */
|
||||
@@ -336,105 +331,61 @@ typedef struct WPreferences {
|
||||
signed char colormap_mode; /* colormap focus mode */
|
||||
signed char focus_mode; /* window focusing mode */
|
||||
|
||||
char opaque_move; /* update window position during */
|
||||
/* move */
|
||||
|
||||
char opaque_move; /* update window position during move */
|
||||
char wrap_menus; /* wrap menus at edge of screen */
|
||||
char scrollable_menus; /* let them be scrolled */
|
||||
char align_menus; /* align menu with their parents */
|
||||
|
||||
char use_saveunders; /* turn on SaveUnders for menus,
|
||||
* icons etc. */
|
||||
char use_saveunders; /* turn on SaveUnders for menus, icons etc. */
|
||||
char no_window_over_dock;
|
||||
|
||||
char no_window_over_icons;
|
||||
WCoord window_place_origin; /* Offset for windows placed on screen */
|
||||
|
||||
WCoord window_place_origin; /* Offset for windows placed on
|
||||
* screen */
|
||||
|
||||
char constrain_window_size; /* don't let windows get bigger than
|
||||
* screen */
|
||||
|
||||
char constrain_window_size; /* don't let windows get bigger than screen */
|
||||
char windows_cycling; /* windoze cycling */
|
||||
char circ_raise; /* raise window after Alt-tabbing */
|
||||
|
||||
char ignore_focus_click;
|
||||
|
||||
char open_transients_with_parent; /* open transient window in
|
||||
same workspace as parent */
|
||||
char open_transients_with_parent; /* open transient window in same workspace as parent */
|
||||
signed char title_justification; /* titlebar text alignment */
|
||||
|
||||
int window_title_clearance;
|
||||
int menu_title_clearance;
|
||||
int menu_text_clearance;
|
||||
|
||||
char multi_byte_text;
|
||||
#ifdef KEEP_XKB_LOCK_STATUS
|
||||
char modelock;
|
||||
#endif
|
||||
|
||||
char no_dithering; /* use dithering or not */
|
||||
|
||||
char no_animations; /* enable/disable animations */
|
||||
|
||||
char no_autowrap; /* wrap workspace when window is moved
|
||||
* to the edge */
|
||||
|
||||
char auto_arrange_icons; /* automagically arrange icons */
|
||||
|
||||
char icon_box_position; /* position to place icons */
|
||||
|
||||
signed char iconification_style; /* position to place icons */
|
||||
|
||||
char disable_root_mouse; /* disable button events in root window */
|
||||
|
||||
char auto_focus; /* focus window when it's mapped */
|
||||
|
||||
|
||||
char *icon_back_file; /* background image for icons */
|
||||
|
||||
WCoord *root_menu_pos; /* initial position of the root menu*/
|
||||
WCoord *app_menu_pos;
|
||||
|
||||
WCoord *win_menu_pos;
|
||||
|
||||
signed char icon_yard; /* aka iconbox */
|
||||
|
||||
int raise_delay; /* delay for autoraise. 0 is disabled */
|
||||
|
||||
int cmap_size; /* size of dithering colormap in colors
|
||||
* per channel */
|
||||
int cmap_size; /* size of dithering colormap in colors per channel */
|
||||
|
||||
int icon_size; /* size of the icon */
|
||||
|
||||
signed char menu_style; /* menu decoration style */
|
||||
|
||||
signed char workspace_name_display_position;
|
||||
|
||||
unsigned int modifier_mask; /* mask to use as kbd modifier */
|
||||
|
||||
|
||||
char ws_advance; /* Create new workspace and advance */
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
unsigned int vdesk_enable;
|
||||
unsigned int vedge_bordersize;
|
||||
unsigned int vedge_hscrollspeed;
|
||||
unsigned int vedge_vscrollspeed;
|
||||
unsigned int vedge_resistance;
|
||||
unsigned int vedge_attraction;
|
||||
#endif
|
||||
|
||||
char ws_cycle; /* Cycle existing workspaces */
|
||||
|
||||
char save_session_on_exit; /* automatically save session on exit */
|
||||
|
||||
char sticky_icons; /* If miniwindows will be onmipresent */
|
||||
|
||||
char dont_confirm_kill; /* do not confirm Kill application */
|
||||
|
||||
char disable_miniwindows;
|
||||
|
||||
char dont_blink; /* do not blink icon selection */
|
||||
|
||||
/* Appearance options */
|
||||
|
||||
@@ -156,9 +156,6 @@ static int setUTitleBack();
|
||||
static int setResizebarBack();
|
||||
static int setWorkspaceBack();
|
||||
static int setWorkspaceSpecificBack();
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
static int setVirtualDeskEnable();
|
||||
#endif
|
||||
static int setMenuTitleColor();
|
||||
static int setMenuTextColor();
|
||||
static int setMenuDisabledColor();
|
||||
@@ -389,28 +386,6 @@ WDefaultEntry optionList[] = {
|
||||
&wPreferences.workspace_border_position, getEnum, updateUsableArea},
|
||||
{"WorkspaceBorderSize", "0", NULL,
|
||||
&wPreferences.workspace_border_size, getInt, updateUsableArea},
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
{"EnableVirtualDesktop", "NO", NULL,
|
||||
&wPreferences.vdesk_enable, getBool, setVirtualDeskEnable},
|
||||
{"VirtualEdgeExtendSpace", "0", NULL,
|
||||
&wPreferences.vedge_bordersize, getInt, NULL},
|
||||
{"VirtualEdgeHorizonScrollSpeed", "30", NULL,
|
||||
&wPreferences.vedge_hscrollspeed, getInt, NULL},
|
||||
{"VirtualEdgeVerticalScrollSpeed", "30", NULL,
|
||||
&wPreferences.vedge_vscrollspeed, getInt, NULL},
|
||||
{"VirtualEdgeResistance", "30", NULL,
|
||||
&wPreferences.vedge_resistance, getInt, NULL},
|
||||
{"VirtualEdgeAttraction", "30", NULL,
|
||||
&wPreferences.vedge_attraction, getInt, NULL},
|
||||
{"VirtualEdgeLeftKey", "None", (void *)WKBD_VDESK_LEFT,
|
||||
NULL, getKeybind, setKeyGrab},
|
||||
{"VirtualEdgeRightKey", "None", (void *)WKBD_VDESK_RIGHT,
|
||||
NULL, getKeybind, setKeyGrab},
|
||||
{"VirtualEdgeUpKey", "None", (void *)WKBD_VDESK_UP,
|
||||
NULL, getKeybind, setKeyGrab},
|
||||
{"VirtualEdgeDownKey", "None", (void *)WKBD_VDESK_DOWN,
|
||||
NULL, getKeybind, setKeyGrab},
|
||||
#endif
|
||||
{"StickyIcons", "NO", NULL,
|
||||
&wPreferences.sticky_icons, getBool, setStickyIcons},
|
||||
{"SaveSessionOnExit", "NO", NULL,
|
||||
@@ -3003,14 +2978,6 @@ static int setWorkspaceBack(WScreen * scr, WDefaultEntry * entry, WMPropList * v
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
static int setVirtualDeskEnable(WScreen * scr, WDefaultEntry * entry, void *foo, void *bar)
|
||||
{
|
||||
wWorkspaceUpdateEdge(scr);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int setWidgetColor(WScreen * scr, WDefaultEntry * entry, WTexture ** texture, void *foo)
|
||||
{
|
||||
if (scr->widget_texture) {
|
||||
|
||||
@@ -1276,13 +1276,6 @@ void wShowInfoPanel(WScreen * scr)
|
||||
strbuf = wstrappend(strbuf, buf);
|
||||
}
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
if (wPreferences.vdesk_enable)
|
||||
strbuf = wstrappend(strbuf, _(", VirtualDesktop enabled"));
|
||||
else
|
||||
strbuf = wstrappend(strbuf, _(", VirtualDesktop disabled"));
|
||||
#endif
|
||||
|
||||
#ifdef XINERAMA
|
||||
strbuf = wstrappend(strbuf, _("\n"));
|
||||
#ifdef SOLARIS_XINERAMA
|
||||
|
||||
27
src/event.c
27
src/event.c
@@ -1060,21 +1060,12 @@ static void handleEnterNotify(XEvent * event)
|
||||
{
|
||||
WWindow *wwin;
|
||||
WObjDescriptor *desc = NULL;
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
void (*vdHandler) (XEvent * event);
|
||||
#endif
|
||||
XEvent ev;
|
||||
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
||||
#ifdef DEBUG
|
||||
printf("got enter notify\n");
|
||||
#endif
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
if (XFindContext(dpy, event->xcrossing.window, wVEdgeContext, (XPointer *) & vdHandler) != XCNOENT) {
|
||||
(*vdHandler) (event);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (XCheckTypedWindowEvent(dpy, event->xcrossing.window, LeaveNotify, &ev)) {
|
||||
/* already left the window... */
|
||||
saveTimestamp(&ev);
|
||||
@@ -1705,24 +1696,6 @@ static void handleKeyPress(XEvent * event)
|
||||
}
|
||||
break;
|
||||
#endif /* KEEP_XKB_LOCK_STATUS */
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
case WKBD_VDESK_LEFT:
|
||||
wWorkspaceKeyboardMoveDesktop(scr, VEC_LEFT);
|
||||
break;
|
||||
|
||||
case WKBD_VDESK_RIGHT:
|
||||
wWorkspaceKeyboardMoveDesktop(scr, VEC_RIGHT);
|
||||
break;
|
||||
|
||||
case WKBD_VDESK_UP:
|
||||
wWorkspaceKeyboardMoveDesktop(scr, VEC_UP);
|
||||
break;
|
||||
|
||||
case WKBD_VDESK_DOWN:
|
||||
wWorkspaceKeyboardMoveDesktop(scr, VEC_DOWN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,13 +90,6 @@ enum {
|
||||
#ifdef KEEP_XKB_LOCK_STATUS
|
||||
WKBD_TOGGLE,
|
||||
#endif
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
WKBD_VDESK_LEFT,
|
||||
WKBD_VDESK_RIGHT,
|
||||
WKBD_VDESK_UP,
|
||||
WKBD_VDESK_DOWN,
|
||||
#endif
|
||||
/* keep this last */
|
||||
WKBD_LAST
|
||||
};
|
||||
|
||||
18
src/menu.c
18
src/menu.c
@@ -1582,10 +1582,6 @@ static void scrollMenuCallback(void *data)
|
||||
int hamount = 0; /* amount to scroll */
|
||||
int vamount = 0;
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
/* don't scroll if it is in vdesk mode */
|
||||
if (!wPreferences.vdesk_enable)
|
||||
#endif
|
||||
getScrollAmount(menu, &hamount, &vamount);
|
||||
|
||||
if (hamount != 0 || vamount != 0) {
|
||||
@@ -1868,11 +1864,6 @@ static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
dragScrollMenuCallback(menu);
|
||||
}
|
||||
}
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
if (wPreferences.vdesk_enable) {
|
||||
wWorkspaceLowerEdge(scr);
|
||||
}
|
||||
#endif
|
||||
|
||||
prevx = bev->x_root;
|
||||
prevy = bev->y_root;
|
||||
@@ -2013,12 +2004,6 @@ static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
|
||||
case Expose:
|
||||
WMHandleEvent(&ev);
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
/* since expose will raise edge up.. I need another ugly hack here */
|
||||
if (wPreferences.vdesk_enable) {
|
||||
wWorkspaceLowerEdge(scr);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2092,9 +2077,6 @@ static void menuMouseDown(WObjDescriptor * desc, XEvent * event)
|
||||
}
|
||||
|
||||
((WMenu *) desc->parent)->flags.inside_handler = 0;
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wMenuMove(WMenu * menu, int x, int y, int submenus)
|
||||
|
||||
@@ -164,13 +164,7 @@ static void showPosition(WWindow * wwin, int x, int y)
|
||||
XDrawLine(dpy, scr->root_win, lgc, x + width + 2, 0, x + width + 2, scr->scr_height);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
WSetGeometryViewShownPosition(scr->gview,
|
||||
x + scr->workspaces[scr->current_workspace]->view_x,
|
||||
y + scr->workspaces[scr->current_workspace]->view_y);
|
||||
#else
|
||||
WSetGeometryViewShownPosition(scr->gview, x, y);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1532,10 +1526,6 @@ int wKeyboardMoveResizeWindow(WWindow * wwin)
|
||||
wArrangeIcons(scr, True);
|
||||
}
|
||||
|
||||
#if defined(VIRTUAL_DESKTOP)
|
||||
wWorkspaceResizeViewport(scr, scr->current_workspace);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1803,11 +1793,6 @@ int wMouseMoveWindow(WWindow * wwin, XEvent * ev)
|
||||
head != wGetHeadForWindow(wwin)) {
|
||||
wArrangeIcons(scr, True);
|
||||
}
|
||||
#if defined(VIRTUAL_DESKTOP)
|
||||
if (started)
|
||||
wWorkspaceResizeViewport(scr, scr->current_workspace);
|
||||
#endif
|
||||
|
||||
return started;
|
||||
}
|
||||
|
||||
@@ -2096,9 +2081,6 @@ void wMouseResizeWindow(WWindow * wwin, XEvent * ev)
|
||||
if (wPreferences.auto_arrange_icons && wXineramaHeads(scr) > 1 && head != wGetHeadForWindow(wwin)) {
|
||||
wArrangeIcons(scr, True);
|
||||
}
|
||||
#if defined(VIRTUAL_DESKTOP)
|
||||
wWorkspaceResizeViewport(scr, scr->current_workspace);
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef LEFT
|
||||
|
||||
10
src/screen.h
10
src/screen.h
@@ -64,21 +64,11 @@ typedef struct WAppIconChain {
|
||||
*/
|
||||
typedef struct _WScreen {
|
||||
int screen; /* screen number */
|
||||
|
||||
#if 0
|
||||
Atom managerAtom; /* WM_Sn atom for manager selection */
|
||||
Window managerWindow; /* window for manager selection */
|
||||
#endif
|
||||
Window info_window; /* for our window manager info stuff */
|
||||
|
||||
int scr_width; /* size of the screen */
|
||||
int scr_height;
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
int virtual_nr_edges;
|
||||
Window * virtual_edges;
|
||||
#endif
|
||||
|
||||
Window root_win; /* root window of screen */
|
||||
int depth; /* depth of the default visual */
|
||||
Colormap colormap; /* root colormap */
|
||||
|
||||
@@ -146,11 +146,6 @@ void CommitStacking(WScreen * scr)
|
||||
}
|
||||
XRestackWindows(dpy, windows, i);
|
||||
wfree(windows);
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
#endif
|
||||
|
||||
WMPostNotificationName(WMNResetStacking, scr, NULL);
|
||||
}
|
||||
|
||||
@@ -253,10 +248,6 @@ void wRaiseFrame(WCoreWindow * frame)
|
||||
}
|
||||
|
||||
notifyStackChange(frame, "raise");
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void wRaiseLowerFrame(WCoreWindow * frame)
|
||||
@@ -367,10 +358,6 @@ void wLowerFrame(WCoreWindow * frame)
|
||||
}
|
||||
|
||||
notifyStackChange(frame, "lower");
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -500,10 +487,6 @@ void MoveInStackListAbove(WCoreWindow * next, WCoreWindow * frame)
|
||||
}
|
||||
|
||||
WMPostNotificationName(WMNResetStacking, scr, NULL);
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -292,13 +292,6 @@
|
||||
|
||||
/* workspace name on switch display */
|
||||
#define WORKSPACE_NAME_FADE_DELAY 30
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
/* workspace virtual edge speed */
|
||||
#define VIRTUALEDGE_SCROLL_VSTEP 30
|
||||
#define VIRTUALEDGE_SCROLL_HSTEP 30
|
||||
#endif
|
||||
|
||||
#define WORKSPACE_NAME_DELAY 400
|
||||
|
||||
/* Delay when cycling colors of selected icons. */
|
||||
|
||||
@@ -137,11 +137,6 @@ typedef struct {
|
||||
unsigned int dont_save_session:1; /* do not save app's state in session */
|
||||
|
||||
unsigned int full_maximize:1;
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
unsigned int virtual_stick:1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* emulate_app_icon must be automatically disabled for apps that can
|
||||
* generate their own appicons and for apps that have no_appicon=1
|
||||
@@ -322,10 +317,6 @@ typedef struct WWindow {
|
||||
#define IS_MOVABLE(w) (!(WFLAGP((w), no_movable) || (w)->flags.fullscreen))
|
||||
#define IS_RESIZABLE(w) (!(WFLAGP((w), no_resizable) || (w)->flags.fullscreen))
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
# define IS_VSTUCK(w) (WFLAGP((w), virtual_stick) || (w)->flags.fullscreen)
|
||||
#endif
|
||||
|
||||
/* XXX: CHECK THIS,.. IT SEEMED WEIRD TO ME!!! */
|
||||
#define IS_OMNIPRESENT(w) ((w)->flags.omnipresent | WFLAGP(w, omnipresent))
|
||||
|
||||
|
||||
25
src/wmspec.c
25
src/wmspec.c
@@ -324,23 +324,12 @@ void wNETWMUpdateDesktop(WScreen * scr)
|
||||
count = scr->workspace_count * 2;
|
||||
views = wmalloc(sizeof(long) * count);
|
||||
/*memset(views, 0, sizeof(long) * count); */
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
sizes[0] = scr->workspaces[scr->current_workspace]->width;
|
||||
sizes[1] = scr->workspaces[scr->current_workspace]->height;
|
||||
#else
|
||||
sizes[0] = scr->scr_width;
|
||||
sizes[1] = scr->scr_height;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < scr->workspace_count; i++) {
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
views[2 * i + 0] = scr->workspaces[i]->view_x;
|
||||
views[2 * i + 1] = scr->workspaces[i]->view_y;
|
||||
#else
|
||||
views[2 * i + 0] = 0;
|
||||
views[2 * i + 1] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
XChangeProperty(dpy, scr->root_win, net_desktop_geometry, XA_CARDINAL, 32,
|
||||
@@ -904,10 +893,6 @@ static Bool updateStrut(WWindow * wwin, Bool adding)
|
||||
|
||||
XFree(data);
|
||||
hasState = True;
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
/* just in case wm_window_type didn't set it already */
|
||||
wwin->client_flags.virtual_stick = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1117,9 +1102,6 @@ static Bool handleWindowType(WWindow * wwin, Atom type, int *layer)
|
||||
wwin->flags.net_skip_pager = 1;
|
||||
wwin->frame_x = 0;
|
||||
wwin->frame_y = 0;
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wwin->client_flags.virtual_stick = 1;
|
||||
#endif
|
||||
} else if (type == net_wm_window_type_dock) {
|
||||
wwin->client_flags.no_titlebar = 1;
|
||||
wwin->client_flags.no_resizable = 1;
|
||||
@@ -1132,9 +1114,6 @@ static Bool handleWindowType(WWindow * wwin, Atom type, int *layer)
|
||||
wwin->client_flags.skip_window_list = 1;
|
||||
wwin->client_flags.dont_move_off = 1;
|
||||
wwin->flags.net_skip_pager = 1;
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wwin->client_flags.virtual_stick = 1;
|
||||
#endif
|
||||
} else if (type == net_wm_window_type_toolbar) {
|
||||
wwin->client_flags.no_titlebar = 1;
|
||||
wwin->client_flags.no_resizable = 1;
|
||||
@@ -1426,10 +1405,6 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent * event)
|
||||
}
|
||||
} else if (event->message_type == net_showing_desktop) {
|
||||
wNETWMShowingDesktop(scr, event->data.l[0]);
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
} else if (event->message_type == net_desktop_viewport) {
|
||||
wWorkspaceSetViewport(scr, scr->current_workspace, event->data.l[0], event->data.l[1]);
|
||||
#endif
|
||||
} else if (event->message_type == net_desktop_names) {
|
||||
handleDesktopNames(event, scr);
|
||||
} else {
|
||||
|
||||
555
src/workspace.c
555
src/workspace.c
@@ -115,11 +115,6 @@ int wWorkspaceNew(WScreen * scr)
|
||||
|
||||
wWorkspaceMenuUpdate(scr, scr->workspace_menu);
|
||||
wWorkspaceMenuUpdate(scr, scr->clip_ws_menu);
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
wspace->view_x = wspace->view_y = 0;
|
||||
wspace->height = scr->scr_height;
|
||||
wspace->width = scr->scr_width;
|
||||
#endif
|
||||
wNETWMUpdateDesktop(scr);
|
||||
WMPostNotificationName(WMNWorkspaceCreated, scr, (void *)(uintptr_t) (scr->workspace_count - 1));
|
||||
XFlush(dpy);
|
||||
@@ -624,556 +619,6 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
|
||||
/* XSync(dpy, False); */
|
||||
}
|
||||
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
|
||||
/* TODO:
|
||||
*
|
||||
* 1) Allow border around each window so the scrolling
|
||||
* won't just stop at the border.
|
||||
* 2) Make pager.
|
||||
*
|
||||
*/
|
||||
|
||||
#define vec_sub(a, b) wmkpoint((a).x-(b).x, (a).y-(b).y)
|
||||
#define vec_add(a, b) wmkpoint((a).x+(b).x, (a).y+(b).y)
|
||||
#define vec_inc(a, b) do { (a).x+=(b).x; (a).y+=(b).y; } while(0)
|
||||
#define vec_dot(a, b) ((a).x*(b).x + (a).y*(b).y)
|
||||
#define vec_scale(a, s) wmkpoint((a).x*s, (a).y*s)
|
||||
#define vec_scale2(a, s, t) wmkpoint((a).x*s, (a).y*t)
|
||||
|
||||
#ifndef HAS_BORDER
|
||||
#define HAS_BORDER(w) (!(WFLAGP((w), no_border)))
|
||||
#endif
|
||||
|
||||
#ifndef IS_VSTUCK
|
||||
#define IS_VSTUCK(w) (WFLAGP((w), virtual_stick))
|
||||
#endif
|
||||
|
||||
#define updateMinimum(l,p,ml,mp) do { if (cmp(l) && (l)<(ml)) { (ml)=(l); (mp)=(p); }; } while(0)
|
||||
|
||||
static Bool cmp_gez(int i)
|
||||
{
|
||||
return (i >= 0);
|
||||
}
|
||||
|
||||
static Bool cmp_gz(int i)
|
||||
{
|
||||
return (i > 0);
|
||||
}
|
||||
|
||||
static WMPoint getClosestEdge(WScreen * scr, WMPoint direction, Bool(*cmp) (int))
|
||||
{
|
||||
WMPoint closest = wmkpoint(0, 0);
|
||||
int closest_len = INT_MAX;
|
||||
WWindow *wwin;
|
||||
|
||||
for (wwin = scr->focused_window; wwin; wwin = wwin->prev) {
|
||||
if (wwin->frame->workspace == scr->current_workspace) {
|
||||
if (!wwin->flags.miniaturized && !IS_VSTUCK(wwin) && !wwin->flags.hidden) {
|
||||
int border = 2 * HAS_BORDER(wwin);
|
||||
int len;
|
||||
int x1, x2, y1, y2;
|
||||
int head = wGetHeadForWindow(wwin);
|
||||
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
||||
WMPoint p;
|
||||
|
||||
x1 = wwin->frame_x - area.x1;
|
||||
y1 = wwin->frame_y - area.y1;
|
||||
x2 = wwin->frame_x + wwin->frame->core->width + border - area.x2;
|
||||
y2 = wwin->frame_y + wwin->frame->core->height + border - area.y2;
|
||||
|
||||
p = wmkpoint(x1, y1);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
|
||||
p = wmkpoint(x1, y2);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
|
||||
p = wmkpoint(x2, y1);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
|
||||
p = wmkpoint(x2, y2);
|
||||
len = vec_dot(direction, p);
|
||||
updateMinimum(len, p, closest_len, closest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
|
||||
static void getViewPosition(WScreen * scr, int workspace, int *x, int *y)
|
||||
{
|
||||
*x = scr->workspaces[workspace]->view_x;
|
||||
*y = scr->workspaces[workspace]->view_y;
|
||||
}
|
||||
|
||||
void wWorkspaceKeyboardMoveDesktop(WScreen * scr, WMPoint direction)
|
||||
{
|
||||
int x, y;
|
||||
WMPoint edge = getClosestEdge(scr, direction, cmp_gz);
|
||||
int len = vec_dot(edge, direction);
|
||||
WMPoint step = vec_scale(direction, len);
|
||||
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
wWorkspaceSetViewport(scr, scr->current_workspace, x + step.x, y + step.y);
|
||||
}
|
||||
|
||||
extern Cursor wCursor[WCUR_LAST];
|
||||
|
||||
static void vdMouseMoveDesktop(XEvent * event, WMPoint direction)
|
||||
{
|
||||
static int lock = False;
|
||||
if (lock)
|
||||
return;
|
||||
lock = True;
|
||||
|
||||
Bool done = False;
|
||||
Bool moved = True;
|
||||
WScreen *scr = wScreenForRootWindow(event->xcrossing.root);
|
||||
WMPoint old_pos = wmkpoint(event->xcrossing.x_root, event->xcrossing.y_root);
|
||||
WMPoint step;
|
||||
int x, y;
|
||||
int resisted = 0;
|
||||
|
||||
if (XGrabPointer(dpy, event->xcrossing.window, False,
|
||||
PointerMotionMask, GrabModeAsync, GrabModeAsync,
|
||||
scr->root_win, wCursor[WCUR_EMPTY], CurrentTime) != GrabSuccess) {
|
||||
|
||||
/* if the grab fails, do it the old fashioned way */
|
||||
step = vec_scale2(direction, wPreferences.vedge_hscrollspeed, wPreferences.vedge_vscrollspeed);
|
||||
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
if (wWorkspaceSetViewport(scr, scr->current_workspace, x + step.x, y + step.y)) {
|
||||
step = vec_scale(direction, 2);
|
||||
XWarpPointer(dpy, None, scr->root_win, 0, 0, 0, 0,
|
||||
event->xcrossing.x_root - step.x, event->xcrossing.y_root - step.y);
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
XSync(dpy, True);
|
||||
|
||||
if (old_pos.x < 0)
|
||||
old_pos.x = 0;
|
||||
if (old_pos.y < 0)
|
||||
old_pos.y = 0;
|
||||
if (old_pos.x > scr->scr_width)
|
||||
old_pos.x = scr->scr_width;
|
||||
if (old_pos.y > scr->scr_height)
|
||||
old_pos.y = scr->scr_height;
|
||||
|
||||
while (!done) {
|
||||
XEvent ev;
|
||||
if (moved) {
|
||||
XWarpPointer(dpy, None, scr->root_win, 0, 0, 0, 0,
|
||||
scr->scr_width / 2, scr->scr_height / 2);
|
||||
moved = False;
|
||||
}
|
||||
WMMaskEvent(dpy, PointerMotionMask, &ev);
|
||||
|
||||
switch (ev.type) {
|
||||
case MotionNotify:
|
||||
{
|
||||
int step_len;
|
||||
step = wmkpoint(ev.xmotion.x_root - scr->scr_width / 2,
|
||||
ev.xmotion.y_root - scr->scr_height / 2);
|
||||
step_len = vec_dot(step, direction);
|
||||
if (step_len < 0) {
|
||||
done = True;
|
||||
break;
|
||||
}
|
||||
|
||||
if (step_len > 0) {
|
||||
Bool do_move = True;
|
||||
int resist = wPreferences.vedge_resistance;
|
||||
WMPoint closest;
|
||||
int closest_len = INT_MAX;
|
||||
if (resist) {
|
||||
closest = getClosestEdge(scr, direction, cmp_gez);
|
||||
closest_len = vec_dot(direction, closest);
|
||||
}
|
||||
|
||||
if (!closest_len) {
|
||||
resisted += step_len;
|
||||
do_move = resisted >= resist;
|
||||
if (do_move) {
|
||||
closest_len = INT_MAX;
|
||||
step_len = resisted - resist;
|
||||
resisted = 0;
|
||||
}
|
||||
}
|
||||
if (do_move) {
|
||||
if (closest_len <= wPreferences.vedge_attraction) {
|
||||
step = vec_scale(direction, closest_len);
|
||||
} else {
|
||||
step = vec_scale(direction, step_len);
|
||||
}
|
||||
|
||||
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
wWorkspaceSetViewport(scr, scr->current_workspace,
|
||||
x + step.x, y + step.y);
|
||||
moved = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
step = vec_add(old_pos, vec_scale(direction, -1));
|
||||
XWarpPointer(dpy, None, scr->root_win, 0, 0, 0, 0, step.x, step.y);
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
|
||||
exit:
|
||||
lock = False;
|
||||
}
|
||||
|
||||
static void vdHandleEnter_u(XEvent * event)
|
||||
{
|
||||
vdMouseMoveDesktop(event, VEC_UP);
|
||||
}
|
||||
|
||||
static void vdHandleEnter_d(XEvent * event)
|
||||
{
|
||||
vdMouseMoveDesktop(event, VEC_DOWN);
|
||||
}
|
||||
|
||||
static void vdHandleEnter_l(XEvent * event)
|
||||
{
|
||||
vdMouseMoveDesktop(event, VEC_LEFT);
|
||||
}
|
||||
|
||||
static void vdHandleEnter_r(XEvent * event)
|
||||
{
|
||||
vdMouseMoveDesktop(event, VEC_RIGHT);
|
||||
}
|
||||
|
||||
#define LEFT_EDGE 0x01
|
||||
#define RIGHT_EDGE 0x02
|
||||
#define TOP_EDGE 0x04
|
||||
#define BOTTOM_EDGE 0x08
|
||||
#define ALL_EDGES 0x0F
|
||||
|
||||
static void createEdges(WScreen * scr)
|
||||
{
|
||||
if (!scr->virtual_edges) {
|
||||
int i, j, w;
|
||||
int vmask;
|
||||
XSetWindowAttributes attribs;
|
||||
|
||||
int heads = wXineramaHeads(scr);
|
||||
int *hasEdges = (int *)wmalloc(sizeof(int) * heads);
|
||||
|
||||
int thickness = 1;
|
||||
int nr_edges = 0;
|
||||
int max_edges = 4 * heads;
|
||||
int head;
|
||||
Window *edges = (Window *) wmalloc(sizeof(Window) * max_edges);
|
||||
|
||||
for (i = 0; i < heads; ++i)
|
||||
hasEdges[i] = ALL_EDGES;
|
||||
for (i = 0; i < heads; ++i) {
|
||||
WMRect i_rect = wGetRectForHead(scr, i);
|
||||
for (j = i + 1; j < heads; ++j) {
|
||||
WMRect j_rect = wGetRectForHead(scr, j);
|
||||
|
||||
int vlen = (WMIN(i_rect.pos.y + i_rect.size.height,
|
||||
j_rect.pos.y + j_rect.size.height) -
|
||||
WMAX(i_rect.pos.y, j_rect.pos.y));
|
||||
|
||||
int hlen = (WMIN(i_rect.pos.x + i_rect.size.width,
|
||||
j_rect.pos.x + j_rect.size.width) -
|
||||
WMAX(i_rect.pos.x, j_rect.pos.x));
|
||||
|
||||
if (vlen > 0 && hlen == 0) { /* horz alignment, vert edges touch */
|
||||
if (i_rect.pos.x < j_rect.pos.x) { /* i left of j */
|
||||
hasEdges[i] &= ~RIGHT_EDGE;
|
||||
hasEdges[j] &= ~LEFT_EDGE;
|
||||
} else { /* j left of i */
|
||||
hasEdges[j] &= ~RIGHT_EDGE;
|
||||
hasEdges[i] &= ~LEFT_EDGE;
|
||||
}
|
||||
} else if (vlen == 0 && hlen > 0) { /* vert alignment, horz edges touch */
|
||||
if (i_rect.pos.y < j_rect.pos.y) { /* i top of j */
|
||||
hasEdges[i] &= ~BOTTOM_EDGE;
|
||||
hasEdges[j] &= ~TOP_EDGE;
|
||||
} else { /* j top of i */
|
||||
hasEdges[j] &= ~BOTTOM_EDGE;
|
||||
hasEdges[i] &= ~TOP_EDGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (w = 0; w < scr->workspace_count; w++) {
|
||||
/* puts("reset workspace"); */
|
||||
wWorkspaceSetViewport(scr, w, 0, 0);
|
||||
}
|
||||
|
||||
vmask = CWEventMask | CWOverrideRedirect;
|
||||
attribs.event_mask = (EnterWindowMask | LeaveWindowMask | VisibilityChangeMask);
|
||||
attribs.override_redirect = True;
|
||||
|
||||
for (head = 0; head < wXineramaHeads(scr); ++head) {
|
||||
WMRect rect = wGetRectForHead(scr, head);
|
||||
|
||||
if (hasEdges[head] & TOP_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win, rect.pos.x, rect.pos.y,
|
||||
rect.size.width, thickness, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext, (XPointer) vdHandleEnter_u);
|
||||
++nr_edges;
|
||||
}
|
||||
|
||||
if (hasEdges[head] & BOTTOM_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win, rect.pos.x,
|
||||
rect.pos.y + rect.size.height - thickness,
|
||||
rect.size.width, thickness, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext, (XPointer) vdHandleEnter_d);
|
||||
++nr_edges;
|
||||
}
|
||||
|
||||
if (hasEdges[head] & LEFT_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win, rect.pos.x, rect.pos.y,
|
||||
thickness, rect.pos.y + rect.size.height, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext, (XPointer) vdHandleEnter_l);
|
||||
++nr_edges;
|
||||
}
|
||||
|
||||
if (hasEdges[head] & RIGHT_EDGE) {
|
||||
edges[nr_edges] =
|
||||
XCreateWindow(dpy, scr->root_win,
|
||||
rect.pos.x + rect.size.width - thickness, rect.pos.y,
|
||||
thickness, rect.size.height, 0,
|
||||
CopyFromParent, InputOnly, CopyFromParent, vmask, &attribs);
|
||||
XSaveContext(dpy, edges[nr_edges], wVEdgeContext, (XPointer) vdHandleEnter_r);
|
||||
++nr_edges;
|
||||
}
|
||||
}
|
||||
|
||||
scr->virtual_nr_edges = nr_edges;
|
||||
scr->virtual_edges = edges;
|
||||
|
||||
for (i = 0; i < scr->virtual_nr_edges; ++i) {
|
||||
XMapWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
wWorkspaceRaiseEdge(scr);
|
||||
|
||||
wfree(hasEdges);
|
||||
}
|
||||
}
|
||||
|
||||
static void destroyEdges(WScreen * scr)
|
||||
{
|
||||
if (scr->virtual_edges) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < scr->virtual_nr_edges; ++i) {
|
||||
XDeleteContext(dpy, scr->virtual_edges[i], wVEdgeContext);
|
||||
XUnmapWindow(dpy, scr->virtual_edges[i]);
|
||||
XDestroyWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
|
||||
wfree(scr->virtual_edges);
|
||||
scr->virtual_edges = NULL;
|
||||
scr->virtual_nr_edges = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void wWorkspaceUpdateEdge(WScreen * scr)
|
||||
{
|
||||
if (wPreferences.vdesk_enable) {
|
||||
createEdges(scr);
|
||||
} else {
|
||||
destroyEdges(scr);
|
||||
}
|
||||
}
|
||||
|
||||
void wWorkspaceRaiseEdge(WScreen * scr)
|
||||
{
|
||||
static int toggle = 0;
|
||||
int i;
|
||||
|
||||
if (!scr->virtual_edges)
|
||||
return;
|
||||
|
||||
if (toggle) {
|
||||
for (i = 0; i < scr->virtual_nr_edges; ++i) {
|
||||
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
} else {
|
||||
for (i = scr->virtual_nr_edges - 1; i >= 0; --i) {
|
||||
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
}
|
||||
|
||||
toggle ^= 1;
|
||||
}
|
||||
|
||||
void wWorkspaceLowerEdge(WScreen * scr)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < scr->virtual_nr_edges; ++i) {
|
||||
XLowerWindow(dpy, scr->virtual_edges[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void wWorkspaceResizeViewport(WScreen * scr, int workspace)
|
||||
{
|
||||
int x, y;
|
||||
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||
wWorkspaceSetViewport(scr, scr->current_workspace, x, y);
|
||||
}
|
||||
|
||||
void updateWorkspaceGeometry(WScreen * scr, int workspace, int *view_x, int *view_y)
|
||||
{
|
||||
int most_left, most_right, most_top, most_bottom;
|
||||
WWindow *wwin;
|
||||
|
||||
int heads = wXineramaHeads(scr);
|
||||
typedef int strut_t[4];
|
||||
strut_t *strut = (strut_t *) wmalloc(heads * sizeof(strut_t));
|
||||
int head, i;
|
||||
|
||||
for (head = 0; head < heads; ++head) {
|
||||
WMRect rect = wGetRectForHead(scr, head);
|
||||
WArea area = wGetUsableAreaForHead(scr, head, NULL, False);
|
||||
strut[head][0] = area.x1 - rect.pos.x;
|
||||
strut[head][1] = rect.pos.x + rect.size.width - area.x2;
|
||||
strut[head][2] = area.y1 - rect.pos.y;
|
||||
strut[head][3] = rect.pos.y + rect.size.height - area.y2;
|
||||
}
|
||||
|
||||
/* adjust workspace layout */
|
||||
wwin = scr->focused_window;
|
||||
most_right = 0;
|
||||
most_bottom = 0;
|
||||
most_left = scr->scr_width;
|
||||
most_top = scr->scr_height;
|
||||
for (; wwin; wwin = wwin->prev) {
|
||||
if (wwin->frame->workspace == workspace) {
|
||||
if (!wwin->flags.miniaturized && !IS_VSTUCK(wwin) && !wwin->flags.hidden) {
|
||||
|
||||
head = wGetHeadForWindow(wwin);
|
||||
|
||||
i = wwin->frame_x - strut[head][0];
|
||||
if (i < most_left) /* record positions, should this be cached? */
|
||||
most_left = i;
|
||||
i = wwin->frame_x + wwin->frame->core->width + strut[head][1];
|
||||
if (HAS_BORDER(wwin))
|
||||
i += 2;
|
||||
if (i > most_right)
|
||||
most_right = i;
|
||||
i = wwin->frame_y - strut[head][2];
|
||||
if (i < most_top)
|
||||
most_top = i;
|
||||
i = wwin->frame_y + wwin->frame->core->height + strut[head][3];
|
||||
if (HAS_BORDER(wwin))
|
||||
i += 2;
|
||||
if (i > most_bottom) {
|
||||
most_bottom = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (most_left > 0)
|
||||
most_left = 0;
|
||||
if (most_top > 0)
|
||||
most_top = 0;
|
||||
|
||||
scr->workspaces[workspace]->width = WMAX(most_right, scr->scr_width) - WMIN(most_left, 0);
|
||||
scr->workspaces[workspace]->height = WMAX(most_bottom, scr->scr_height) - WMIN(most_top, 0);
|
||||
|
||||
*view_x += -most_left - scr->workspaces[workspace]->view_x;
|
||||
scr->workspaces[workspace]->view_x = -most_left;
|
||||
|
||||
*view_y += -most_top - scr->workspaces[workspace]->view_y;
|
||||
scr->workspaces[workspace]->view_y = -most_top;
|
||||
|
||||
wfree(strut);
|
||||
}
|
||||
|
||||
typedef struct _delay_configure {
|
||||
WWindow *wwin;
|
||||
int delay_count;
|
||||
} _delay_configure;
|
||||
|
||||
void sendConfigureNotify(_delay_configure * delay)
|
||||
{
|
||||
WWindow *wwin;
|
||||
|
||||
delay->delay_count--;
|
||||
if (!delay->delay_count) {
|
||||
for (wwin = delay->wwin; wwin; wwin = wwin->prev) {
|
||||
wWindowSynthConfigureNotify(wwin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bool wWorkspaceSetViewport(WScreen * scr, int workspace, int view_x, int view_y)
|
||||
{
|
||||
Bool adjust_flag = False;
|
||||
int diff_x, diff_y;
|
||||
static _delay_configure delay_configure = { NULL, 0 };
|
||||
WWorkspace *wptr;
|
||||
WWindow *wwin;
|
||||
|
||||
wptr = scr->workspaces[workspace];
|
||||
|
||||
/*printf("wWorkspaceSetViewport %d %d\n", view_x, view_y); */
|
||||
|
||||
updateWorkspaceGeometry(scr, workspace, &view_x, &view_y);
|
||||
|
||||
if (view_x + scr->scr_width > wptr->width) {
|
||||
/* puts("right edge of vdesk"); */
|
||||
view_x = wptr->width - scr->scr_width;
|
||||
}
|
||||
if (view_x < 0) {
|
||||
/* puts("left edge of vdesk"); */
|
||||
view_x = 0;
|
||||
}
|
||||
if (view_y + scr->scr_height > wptr->height) {
|
||||
/* puts("right edge of vdesk"); */
|
||||
view_y = wptr->height - scr->scr_height;
|
||||
}
|
||||
if (view_y < 0) {
|
||||
/* puts("left edge of vdesk"); */
|
||||
view_y = 0;
|
||||
}
|
||||
|
||||
diff_x = wptr->view_x - view_x;
|
||||
diff_y = wptr->view_y - view_y;
|
||||
if (!diff_x && !diff_y)
|
||||
return False;
|
||||
|
||||
wptr->view_x = view_x;
|
||||
wptr->view_y = view_y;
|
||||
|
||||
wNETWMUpdateDesktop(scr);
|
||||
|
||||
for (wwin = scr->focused_window; wwin; wwin = wwin->prev) {
|
||||
if (wwin->frame->workspace == workspace && !IS_VSTUCK(wwin)) {
|
||||
wWindowMove(wwin, wwin->frame_x + diff_x, wwin->frame_y + diff_y);
|
||||
adjust_flag = True;
|
||||
}
|
||||
}
|
||||
if (1) { /* if delay */
|
||||
delay_configure.delay_count++;
|
||||
delay_configure.wwin = scr->focused_window;
|
||||
WMAddTimerHandler(200, (WMCallback *) sendConfigureNotify, &delay_configure);
|
||||
}
|
||||
|
||||
return adjust_flag;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void switchWSCommand(WMenu * menu, WMenuEntry * entry)
|
||||
{
|
||||
wWorkspaceChange(menu->frame->screen_ptr, (long)entry->clientdata);
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
typedef struct WWorkspace {
|
||||
char *name;
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
int width, height;
|
||||
int view_x, view_y;
|
||||
#endif
|
||||
struct WDock *clip;
|
||||
} WWorkspace;
|
||||
|
||||
@@ -39,32 +35,12 @@ int wWorkspaceNew(WScreen *scr);
|
||||
Bool wWorkspaceDelete(WScreen *scr, int workspace);
|
||||
void wWorkspaceChange(WScreen *scr, int workspace);
|
||||
void wWorkspaceForceChange(WScreen *scr, int workspace);
|
||||
#ifdef VIRTUAL_DESKTOP
|
||||
void wWorkspaceUpdateEdge(WScreen *scr);
|
||||
void wWorkspaceRaiseEdge(WScreen *scr);
|
||||
void wWorkspaceLowerEdge(WScreen *scr);
|
||||
void wWorkspaceResizeViewport(WScreen *scr, int workspace);
|
||||
Bool wWorkspaceSetViewport(WScreen *scr, int workspace, int view_x, int view_y);
|
||||
void wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction);
|
||||
|
||||
#define VEC_LEFT wmkpoint(-1,0)
|
||||
#define VEC_RIGHT wmkpoint(1,0)
|
||||
#define VEC_UP wmkpoint(0,-1)
|
||||
#define VEC_DOWN wmkpoint(0,1)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
WMenu *wWorkspaceMenuMake(WScreen *scr, Bool titled);
|
||||
void wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu);
|
||||
|
||||
void wWorkspaceMenuEdit(WScreen *scr);
|
||||
|
||||
void wWorkspaceSaveState(WScreen *scr, WMPropList *old_state);
|
||||
void wWorkspaceRestoreState(WScreen *scr);
|
||||
|
||||
void wWorkspaceRename(WScreen *scr, int workspace, char *name);
|
||||
|
||||
void wWorkspaceRelativeChange(WScreen *scr, int amount);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user