diff --git a/src/WindowMaker.h b/src/WindowMaker.h index ba3a69ba..8e292507 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -381,8 +381,8 @@ typedef struct WPreferences { unsigned int vedge_thickness; unsigned int vedge_hscrollspeed; unsigned int vedge_vscrollspeed; - unsigned int vedge_height; /* could be change to workspace specific one day */ - unsigned int vedge_width; + unsigned int vedge_maxheight; + unsigned int vedge_maxwidth; #endif char ws_cycle; /* Cycle existing workspaces */ diff --git a/src/defaults.c b/src/defaults.c index e76a361e..41baf435 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -451,11 +451,11 @@ WDefaultEntry optionList[] = { {"VirtualEdgeVerticalScrollSpeed", "1", NULL, &wPreferences.vedge_vscrollspeed, getInt, NULL }, - {"VirtualEdgeWidth", "2000", NULL, - &wPreferences.vedge_width, getInt, NULL + {"VirtualEdgeMaximumWidth", "3000", NULL, + &wPreferences.vedge_maxwidth, getInt, NULL }, - {"VirtualEdgeHeight", "2000", NULL, - &wPreferences.vedge_height, getInt, NULL + {"VirtualEdgeMaximumHeight", "3000", NULL, + &wPreferences.vedge_maxheight, getInt, NULL }, #endif {"StickyIcons", "NO", NULL, diff --git a/src/event.c b/src/event.c index 64762ad2..3165c325 100644 --- a/src/event.c +++ b/src/event.c @@ -1002,20 +1002,20 @@ handleEnterNotify(XEvent *event) int x,y; if (event->xcrossing.window == scr->virtual_edge_r) { XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, scr->scr_width - wPreferences.vedge_thickness - 1, event->xcrossing.y_root); - wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y); - wWorkspaceSetViewPort(scr, scr->current_workspace, x+30, y); + wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL); + wWorkspaceSetViewPort(scr, scr->current_workspace, x + VIRTUALEDGE_SCROLL_HSTEP, y); } else if (event->xcrossing.window == scr->virtual_edge_l) { XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, wPreferences.vedge_thickness + 1, event->xcrossing.y_root); - wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y); - wWorkspaceSetViewPort(scr, scr->current_workspace, x-30, y); + wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL); + wWorkspaceSetViewPort(scr, scr->current_workspace, x - VIRTUALEDGE_SCROLL_HSTEP, y); } else if (event->xcrossing.window == scr->virtual_edge_u) { XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, event->xcrossing.x_root, wPreferences.vedge_thickness + 1); - wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y); - wWorkspaceSetViewPort(scr, scr->current_workspace, x, y-30); + wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL); + wWorkspaceSetViewPort(scr, scr->current_workspace, x, y - VIRTUALEDGE_SCROLL_VSTEP); } else if (event->xcrossing.window == scr->virtual_edge_d) { XWarpPointer(dpy, None, scr->root_win, 0,0,0,0, event->xcrossing.x_root, scr->scr_height - wPreferences.vedge_thickness - 1); - wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y); - wWorkspaceSetViewPort(scr, scr->current_workspace, x, y+30); + wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL); + wWorkspaceSetViewPort(scr, scr->current_workspace, x, y + VIRTUALEDGE_SCROLL_VSTEP); } } #endif diff --git a/src/moveres.c b/src/moveres.c index a6a958c1..f0fac049 100644 --- a/src/moveres.c +++ b/src/moveres.c @@ -148,7 +148,13 @@ showPosition(WWindow *wwin, int x, int y) 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 } } diff --git a/src/wconfig.h.in b/src/wconfig.h.in index a398dcac..f97bedb0 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -431,6 +431,12 @@ /* 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 /* window birth animation steps (DO NOT MAKE IT RUN-TIME) */ diff --git a/src/workspace.c b/src/workspace.c index 9a1c51be..332e49fd 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -64,7 +64,7 @@ static proplist_t dWorkspaces=NULL; static proplist_t dClip, dName; #ifdef VIRTUAL_DESKTOP -static BOOL initVDesk=False; +static BOOL initVDesk = False; #endif static void @@ -637,17 +637,17 @@ wWorkspaceForceChange(WScreen *scr, int workspace) #ifdef VIRTUAL_DESKTOP void wWorkspaceManageEdge(WScreen *scr) { - int i; + int w; int vmask; XSetWindowAttributes attribs; - puts("ok"); + puts("wWorkspaceManageEdge()"); if (wPreferences.vedge_thickness) { - initVDesk=True; - for (i = 0;i < scr->workspace_count; i++) { + initVDesk = True; + for (w = 0; w < scr->workspace_count; w++) { puts("reset workspace"); - scr->workspaces[i]->x = scr->workspaces[i]->y = 0; - wWorkspaceResizeViewPort(scr, i, wPreferences.vedge_width, wPreferences.vedge_height); + wWorkspaceResizeViewPort(scr, w, 0, 0, wPreferences.vedge_maxwidth, wPreferences.vedge_maxheight); + wWorkspaceSetViewPort(scr, w, 0, 0); } vmask = CWEventMask|CWOverrideRedirect; @@ -686,33 +686,35 @@ void wWorkspaceRaiseEdge(WScreen *scr) { } } -void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int width, int height) +void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int x, int y, int width, int height) { if (width < scr->scr_width) return; if (height < scr->scr_height) return; + scr->workspaces[workspace]->x = x; + scr->workspaces[workspace]->y = y; scr->workspaces[workspace]->width = WMAX(width,scr->scr_width); scr->workspaces[workspace]->height = WMAX(height,scr->scr_height); } -void wWorkspaceSetViewPort(WScreen *scr, int workspace, int x, int y) +void wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y) { int diff_x, diff_y; WWindow *wwin; - if (x < 0) return; - if (y < 0) return; - if (x + scr->scr_width > scr->workspaces[workspace]->width) return; - if (y + scr->scr_height > scr->workspaces[workspace]->height) return; + if (view_x < scr->workspaces[workspace]->x + || view_y < scr->workspaces[workspace]->y + || view_x + scr->scr_width > scr->workspaces[workspace]->width + || view_y + scr->scr_height > scr->workspaces[workspace]->height) return; - diff_x = scr->workspaces[workspace]->x - x; - diff_y = scr->workspaces[workspace]->y - y; + diff_x = scr->workspaces[workspace]->view_x - view_x; + diff_y = scr->workspaces[workspace]->view_y - view_y; - scr->workspaces[workspace]->x = WMIN(x, scr->workspaces[workspace]->width - scr->scr_width); - scr->workspaces[workspace]->y = WMIN(y, scr->workspaces[workspace]->height - scr->scr_height); + scr->workspaces[workspace]->view_x = WMIN(view_x, scr->workspaces[workspace]->width - scr->scr_width); + scr->workspaces[workspace]->view_y = WMIN(view_y, scr->workspaces[workspace]->height - scr->scr_height); - printf("set view %d %d, %d\n",workspace, scr->workspaces[workspace]->x, scr->workspaces[workspace]->y); + printf("set view %d %d, %d\n",workspace, scr->workspaces[workspace]->view_x, scr->workspaces[workspace]->view_y); wwin = scr->focused_window; while (wwin) { @@ -724,9 +726,11 @@ void wWorkspaceSetViewPort(WScreen *scr, int workspace, int x, int y) } } -void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *x, int *y) { - *x = scr->workspaces[workspace]->x; - *y = scr->workspaces[workspace]->y; +void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y, int *x, int *y) { + if (view_x) *view_x = scr->workspaces[workspace]->view_x; + if (view_y) *view_y = scr->workspaces[workspace]->view_y; + if (x) *x = scr->workspaces[workspace]->x; + if (y) *y = scr->workspaces[workspace]->y; } #endif diff --git a/src/workspace.h b/src/workspace.h index 63d65572..3729bdd1 100644 --- a/src/workspace.h +++ b/src/workspace.h @@ -29,6 +29,7 @@ typedef struct WWorkspace { char *name; #ifdef VIRTUAL_DESKTOP int x ,y, width, height; + int view_x, view_y; #endif struct WDock *clip; } WWorkspace; @@ -41,9 +42,9 @@ void wWorkspaceForceChange(WScreen *scr, int workspace); #ifdef VIRTUAL_DESKTOP void wWorkspaceManageEdge(WScreen *scr); void wWorkspaceRaiseEdge(WScreen *scr); -void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int width, int height); -void wWorkspaceSetViewPort(WScreen *scr, int workspace, int x, int y); -void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *x, int *y); +void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int x, int y, int width, int height); +void wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y); +void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y, int *x, int *y); #endif