1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 05:18:06 +01:00

Changes relate to virtual edge.

This commit is contained in:
id
2000-11-19 10:33:41 +00:00
parent 9bd00e5cd2
commit b0506c3737
3 changed files with 56 additions and 31 deletions

View File

@@ -1002,19 +1002,19 @@ 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, NULL, NULL); wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x + VIRTUALEDGE_SCROLL_HSTEP, 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, NULL, NULL); wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x - VIRTUALEDGE_SCROLL_HSTEP, 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, NULL, NULL); wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y - VIRTUALEDGE_SCROLL_VSTEP); 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, NULL, NULL); wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y + VIRTUALEDGE_SCROLL_VSTEP); wWorkspaceSetViewPort(scr, scr->current_workspace, x, y + VIRTUALEDGE_SCROLL_VSTEP);
} }
} }

View File

@@ -636,7 +636,8 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
#ifdef VIRTUAL_DESKTOP #ifdef VIRTUAL_DESKTOP
void wWorkspaceManageEdge(WScreen *scr) { void wWorkspaceManageEdge(WScreen *scr)
{
int w; int w;
int vmask; int vmask;
XSetWindowAttributes attribs; XSetWindowAttributes attribs;
@@ -646,7 +647,7 @@ void wWorkspaceManageEdge(WScreen *scr) {
initVDesk = True; initVDesk = True;
for (w = 0; w < scr->workspace_count; w++) { for (w = 0; w < scr->workspace_count; w++) {
puts("reset workspace"); puts("reset workspace");
wWorkspaceResizeViewPort(scr, w, 0, 0, wPreferences.vedge_maxwidth, wPreferences.vedge_maxheight); wWorkspaceResizeViewPort(scr, w, wPreferences.vedge_maxwidth, wPreferences.vedge_maxheight);
wWorkspaceSetViewPort(scr, w, 0, 0); wWorkspaceSetViewPort(scr, w, 0, 0);
} }
@@ -677,7 +678,8 @@ void wWorkspaceManageEdge(WScreen *scr) {
} }
} }
void wWorkspaceRaiseEdge(WScreen *scr) { void wWorkspaceRaiseEdge(WScreen *scr)
{
if (wPreferences.vedge_thickness && initVDesk) { if (wPreferences.vedge_thickness && initVDesk) {
XRaiseWindow(dpy, scr->virtual_edge_u); XRaiseWindow(dpy, scr->virtual_edge_u);
XRaiseWindow(dpy, scr->virtual_edge_d); XRaiseWindow(dpy, scr->virtual_edge_d);
@@ -686,36 +688,22 @@ void wWorkspaceRaiseEdge(WScreen *scr) {
} }
} }
void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int x, int y, int width, int height) void wWorkspaceResizeViewPort(WScreen *scr, int workspace, 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]->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 view_x, int view_y) void wWorkspaceAdjustViewPort(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 (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]->view_x - view_x; diff_x = scr->workspaces[workspace]->view_x - view_x;
diff_y = scr->workspaces[workspace]->view_y - view_y; diff_y = scr->workspaces[workspace]->view_y - view_y;
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]->view_x, scr->workspaces[workspace]->view_y);
wwin = scr->focused_window; wwin = scr->focused_window;
while (wwin) { while (wwin) {
if (wwin->frame->workspace == workspace) { if (wwin->frame->workspace == workspace) {
@@ -724,13 +712,49 @@ void wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
} }
wwin = wwin->prev; wwin = wwin->prev;
} }
if (scr->workspaces[workspace]->view_x < 0) {
scr->workspaces[workspace]->width -= view_x;
scr->workspaces[workspace]->view_x = 0;
} else if (scr->workspaces[workspace]->view_x > scr->workspaces[workspace]->width - scr->scr_width) {
scr->workspaces[workspace]->width = scr->workspaces[workspace]->view_x + scr->scr_width;
} }
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y, int *x, int *y) { if (scr->workspaces[workspace]->view_y < 0) {
scr->workspaces[workspace]->height -= view_y;
scr->workspaces[workspace]->view_y = 0;
} else if (scr->workspaces[workspace]->view_y > scr->workspaces[workspace]->height - scr->scr_height) {
scr->workspaces[workspace]->height = scr->workspaces[workspace]->view_y + 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]->view_x, scr->workspaces[workspace]->view_y);
*/
}
void wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
{
if (view_x < 0) view_x = 0;
else if (view_x > scr->workspaces[workspace]->width - scr->scr_width)
view_x = scr->workspaces[workspace]->width - scr->scr_width;
if (view_y < 0) view_y = 0;
else if (view_y > scr->workspaces[workspace]->width - scr->scr_height)
view_y = scr->workspaces[workspace]->width - scr->scr_height;
wWorkspaceAdjustViewPort(scr, workspace, view_x, view_y);
}
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y) {
if (view_x) *view_x = scr->workspaces[workspace]->view_x; if (view_x) *view_x = scr->workspaces[workspace]->view_x;
if (view_y) *view_y = scr->workspaces[workspace]->view_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

View File

@@ -28,7 +28,7 @@
typedef struct WWorkspace { typedef struct WWorkspace {
char *name; char *name;
#ifdef VIRTUAL_DESKTOP #ifdef VIRTUAL_DESKTOP
int x ,y, width, height; int width, height;
int view_x, view_y; int view_x, view_y;
#endif #endif
struct WDock *clip; struct WDock *clip;
@@ -42,9 +42,10 @@ 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 x, int y, int width, int height); void wWorkspaceResizeViewPort(WScreen *scr, int workspace, int width, int height);
void wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y); 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); void wWorkspaceAdjustViewPort(WScreen *scr, int workspace, int view_x, int view_y);
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y);
#endif #endif