mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Changes relate to virtual edge.
This commit is contained in:
@@ -381,8 +381,8 @@ typedef struct WPreferences {
|
|||||||
unsigned int vedge_thickness;
|
unsigned int vedge_thickness;
|
||||||
unsigned int vedge_hscrollspeed;
|
unsigned int vedge_hscrollspeed;
|
||||||
unsigned int vedge_vscrollspeed;
|
unsigned int vedge_vscrollspeed;
|
||||||
unsigned int vedge_height; /* could be change to workspace specific one day */
|
unsigned int vedge_maxheight;
|
||||||
unsigned int vedge_width;
|
unsigned int vedge_maxwidth;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char ws_cycle; /* Cycle existing workspaces */
|
char ws_cycle; /* Cycle existing workspaces */
|
||||||
|
|||||||
@@ -451,11 +451,11 @@ WDefaultEntry optionList[] = {
|
|||||||
{"VirtualEdgeVerticalScrollSpeed", "1", NULL,
|
{"VirtualEdgeVerticalScrollSpeed", "1", NULL,
|
||||||
&wPreferences.vedge_vscrollspeed, getInt, NULL
|
&wPreferences.vedge_vscrollspeed, getInt, NULL
|
||||||
},
|
},
|
||||||
{"VirtualEdgeWidth", "2000", NULL,
|
{"VirtualEdgeMaximumWidth", "3000", NULL,
|
||||||
&wPreferences.vedge_width, getInt, NULL
|
&wPreferences.vedge_maxwidth, getInt, NULL
|
||||||
},
|
},
|
||||||
{"VirtualEdgeHeight", "2000", NULL,
|
{"VirtualEdgeMaximumHeight", "3000", NULL,
|
||||||
&wPreferences.vedge_height, getInt, NULL
|
&wPreferences.vedge_maxheight, getInt, NULL
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
{"StickyIcons", "NO", NULL,
|
{"StickyIcons", "NO", NULL,
|
||||||
|
|||||||
16
src/event.c
16
src/event.c
@@ -1002,20 +1002,20 @@ handleEnterNotify(XEvent *event)
|
|||||||
int x,y;
|
int x,y;
|
||||||
if (event->xcrossing.window == scr->virtual_edge_r) {
|
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);
|
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);
|
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x+30, y);
|
wWorkspaceSetViewPort(scr, scr->current_workspace, x + VIRTUALEDGE_SCROLL_HSTEP, y);
|
||||||
} else if (event->xcrossing.window == scr->virtual_edge_l) {
|
} 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);
|
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);
|
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x-30, y);
|
wWorkspaceSetViewPort(scr, scr->current_workspace, x - VIRTUALEDGE_SCROLL_HSTEP, y);
|
||||||
} else if (event->xcrossing.window == scr->virtual_edge_u) {
|
} 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);
|
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);
|
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y-30);
|
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y - VIRTUALEDGE_SCROLL_VSTEP);
|
||||||
} else if (event->xcrossing.window == scr->virtual_edge_d) {
|
} 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);
|
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);
|
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y, NULL, NULL);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y+30);
|
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y + VIRTUALEDGE_SCROLL_VSTEP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -148,7 +148,13 @@ showPosition(WWindow *wwin, int x, int y)
|
|||||||
scr->scr_height);
|
scr->scr_height);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} 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);
|
WSetGeometryViewShownPosition(scr->gview, x, y);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -431,6 +431,12 @@
|
|||||||
/* workspace name on switch display */
|
/* workspace name on switch display */
|
||||||
#define WORKSPACE_NAME_FADE_DELAY 30
|
#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
|
#define WORKSPACE_NAME_DELAY 400
|
||||||
|
|
||||||
/* window birth animation steps (DO NOT MAKE IT RUN-TIME) */
|
/* window birth animation steps (DO NOT MAKE IT RUN-TIME) */
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ static proplist_t dWorkspaces=NULL;
|
|||||||
static proplist_t dClip, dName;
|
static proplist_t dClip, dName;
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
static BOOL initVDesk=False;
|
static BOOL initVDesk = False;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -637,17 +637,17 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
|
|
||||||
void wWorkspaceManageEdge(WScreen *scr) {
|
void wWorkspaceManageEdge(WScreen *scr) {
|
||||||
int i;
|
int w;
|
||||||
int vmask;
|
int vmask;
|
||||||
XSetWindowAttributes attribs;
|
XSetWindowAttributes attribs;
|
||||||
|
|
||||||
puts("ok");
|
puts("wWorkspaceManageEdge()");
|
||||||
if (wPreferences.vedge_thickness) {
|
if (wPreferences.vedge_thickness) {
|
||||||
initVDesk=True;
|
initVDesk = True;
|
||||||
for (i = 0;i < scr->workspace_count; i++) {
|
for (w = 0; w < scr->workspace_count; w++) {
|
||||||
puts("reset workspace");
|
puts("reset workspace");
|
||||||
scr->workspaces[i]->x = scr->workspaces[i]->y = 0;
|
wWorkspaceResizeViewPort(scr, w, 0, 0, wPreferences.vedge_maxwidth, wPreferences.vedge_maxheight);
|
||||||
wWorkspaceResizeViewPort(scr, i, wPreferences.vedge_width, wPreferences.vedge_height);
|
wWorkspaceSetViewPort(scr, w, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vmask = CWEventMask|CWOverrideRedirect;
|
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 (width < scr->scr_width) return;
|
||||||
if (height < scr->scr_height) 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]->width = WMAX(width,scr->scr_width);
|
||||||
scr->workspaces[workspace]->height = WMAX(height,scr->scr_height);
|
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;
|
int diff_x, diff_y;
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
|
|
||||||
if (x < 0) return;
|
if (view_x < scr->workspaces[workspace]->x
|
||||||
if (y < 0) return;
|
|| view_y < scr->workspaces[workspace]->y
|
||||||
if (x + scr->scr_width > scr->workspaces[workspace]->width) return;
|
|| view_x + scr->scr_width > scr->workspaces[workspace]->width
|
||||||
if (y + scr->scr_height > scr->workspaces[workspace]->height) return;
|
|| view_y + scr->scr_height > scr->workspaces[workspace]->height) return;
|
||||||
|
|
||||||
diff_x = scr->workspaces[workspace]->x - x;
|
diff_x = scr->workspaces[workspace]->view_x - view_x;
|
||||||
diff_y = scr->workspaces[workspace]->y - y;
|
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]->view_x = WMIN(view_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_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;
|
wwin = scr->focused_window;
|
||||||
while (wwin) {
|
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) {
|
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y, int *x, int *y) {
|
||||||
*x = scr->workspaces[workspace]->x;
|
if (view_x) *view_x = scr->workspaces[workspace]->view_x;
|
||||||
*y = scr->workspaces[workspace]->y;
|
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
|
#endif
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ typedef struct WWorkspace {
|
|||||||
char *name;
|
char *name;
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
int x ,y, width, height;
|
int x ,y, width, height;
|
||||||
|
int view_x, view_y;
|
||||||
#endif
|
#endif
|
||||||
struct WDock *clip;
|
struct WDock *clip;
|
||||||
} WWorkspace;
|
} WWorkspace;
|
||||||
@@ -41,9 +42,9 @@ void wWorkspaceForceChange(WScreen *scr, int workspace);
|
|||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
void wWorkspaceManageEdge(WScreen *scr);
|
void wWorkspaceManageEdge(WScreen *scr);
|
||||||
void wWorkspaceRaiseEdge(WScreen *scr);
|
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);
|
||||||
void wWorkspaceSetViewPort(WScreen *scr, int workspace, int x, int y);
|
void wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y);
|
||||||
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *x, int *y);
|
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y, int *x, int *y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user