mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
- Fix that enables that the virtual desktop code be disabled on the fly
when VirtualEdgeThickness is set to 0 - Fixed virtual edge to resize the edge on the fly if thickness changes
This commit is contained in:
@@ -3,6 +3,10 @@ Changes since version 0.90.0:
|
|||||||
|
|
||||||
- added _NET_WM_NAME, _NET_WM_ICON_NAME and _NET_WM_ICON to WINGs
|
- added _NET_WM_NAME, _NET_WM_ICON_NAME and _NET_WM_ICON to WINGs
|
||||||
- new WPrefs icon (thanks to Largo)
|
- new WPrefs icon (thanks to Largo)
|
||||||
|
- fixed virtual desktop to disable the virtual edge on the fly if thickness
|
||||||
|
is set to 0.
|
||||||
|
- fixed virtual desktop to resize the edge on the fly when edge thickness
|
||||||
|
changes.
|
||||||
|
|
||||||
|
|
||||||
Changes since version 0.80.2:
|
Changes since version 0.80.2:
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ extern int wScreenCount;
|
|||||||
int showCrashDialog(int sig)
|
int showCrashDialog(int sig)
|
||||||
{
|
{
|
||||||
int crashAction;
|
int crashAction;
|
||||||
Display *dpy;
|
|
||||||
|
|
||||||
dpy = XOpenDisplay("");
|
dpy = XOpenDisplay("");
|
||||||
if (dpy) {
|
if (dpy) {
|
||||||
|
|||||||
@@ -1613,7 +1613,7 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
|||||||
|
|
||||||
|
|
||||||
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
|
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
|
||||||
wWorkspaceResizeViewPort(scr, scr->current_workspace);
|
wWorkspaceResizeViewport(scr, scr->current_workspace);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1908,7 +1908,7 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
|
|||||||
|
|
||||||
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
|
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
|
||||||
if (started)
|
if (started)
|
||||||
wWorkspaceResizeViewPort(scr, scr->current_workspace);
|
wWorkspaceResizeViewport(scr, scr->current_workspace);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return started;
|
return started;
|
||||||
@@ -2207,7 +2207,7 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
|
#if defined(NETWM_HINTS) && defined(VIRTUAL_DESKTOP)
|
||||||
wWorkspaceResizeViewPort(scr, scr->current_workspace);
|
wWorkspaceResizeViewport(scr, scr->current_workspace);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1431,7 +1431,7 @@ wNETWMProcessClientMessage(XClientMessageEvent *event)
|
|||||||
wNETWMShowingDesktop(scr, event->data.l[0]);
|
wNETWMShowingDesktop(scr, event->data.l[0]);
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
} else if (event->message_type == net_desktop_viewport) {
|
} else if (event->message_type == net_desktop_viewport) {
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace,
|
wWorkspaceSetViewport(scr, scr->current_workspace,
|
||||||
event->data.l[0], event->data.l[1]);
|
event->data.l[0], event->data.l[1]);
|
||||||
#endif
|
#endif
|
||||||
} else if (event->message_type == net_desktop_names) {
|
} else if (event->message_type == net_desktop_names) {
|
||||||
|
|||||||
115
src/workspace.c
115
src/workspace.c
@@ -63,9 +63,6 @@ extern void ProcessPendingEvents();
|
|||||||
static WMPropList *dWorkspaces=NULL;
|
static WMPropList *dWorkspaces=NULL;
|
||||||
static WMPropList *dClip, *dName;
|
static WMPropList *dClip, *dName;
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
|
||||||
static BOOL initVDesk = False;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -719,6 +716,14 @@ getClosestEdge(WScreen * scr, WMPoint direction, Bool (*cmp)(int))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
getViewPosition(WScreen *scr, int workspace, int *x, int *y)
|
||||||
|
{
|
||||||
|
*x = scr->workspaces[workspace]->view_x;
|
||||||
|
*y = scr->workspaces[workspace]->view_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction)
|
wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction)
|
||||||
{
|
{
|
||||||
@@ -726,8 +731,8 @@ wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction)
|
|||||||
WMPoint edge = getClosestEdge(scr, direction, cmp_gz);
|
WMPoint edge = getClosestEdge(scr, direction, cmp_gz);
|
||||||
int len = vec_dot(edge, direction);
|
int len = vec_dot(edge, direction);
|
||||||
WMPoint step = vec_scale(direction, len);
|
WMPoint step = vec_scale(direction, len);
|
||||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x+step.x, y+step.y);
|
wWorkspaceSetViewport(scr, scr->current_workspace, x+step.x, y+step.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -757,8 +762,8 @@ vdMouseMoveDesktop(XEvent *event, WMPoint direction)
|
|||||||
/* if the grab fails, do it the old fashioned way */
|
/* if the grab fails, do it the old fashioned way */
|
||||||
step = vec_scale2(direction, wPreferences.vedge_hscrollspeed,
|
step = vec_scale2(direction, wPreferences.vedge_hscrollspeed,
|
||||||
wPreferences.vedge_vscrollspeed);
|
wPreferences.vedge_vscrollspeed);
|
||||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||||
if (wWorkspaceSetViewPort(scr, scr->current_workspace,
|
if (wWorkspaceSetViewport(scr, scr->current_workspace,
|
||||||
x+step.x, y+step.y)) {
|
x+step.x, y+step.y)) {
|
||||||
step = vec_scale(direction, wPreferences.vedge_thickness + 1);
|
step = vec_scale(direction, wPreferences.vedge_thickness + 1);
|
||||||
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0,
|
XWarpPointer(dpy, None, scr->root_win, 0,0,0,0,
|
||||||
@@ -825,8 +830,8 @@ vdMouseMoveDesktop(XEvent *event, WMPoint direction)
|
|||||||
step = vec_scale(direction, step_len);
|
step = vec_scale(direction, step_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace,
|
wWorkspaceSetViewport(scr, scr->current_workspace,
|
||||||
x+step.x, y+step.y);
|
x+step.x, y+step.y);
|
||||||
moved = True;
|
moved = True;
|
||||||
}
|
}
|
||||||
@@ -869,30 +874,6 @@ vdHandleEnter_r(XEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
wWorkspaceMapEdge(WScreen *scr)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
if (wPreferences.vedge_thickness && initVDesk) {
|
|
||||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
|
||||||
XMapWindow(dpy, scr->virtual_edges[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
wWorkspaceUnmapEdge(WScreen *scr)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
if (wPreferences.vedge_thickness && initVDesk) {
|
|
||||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
|
||||||
XUnmapWindow(dpy, scr->virtual_edges[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define LEFT_EDGE 0x01
|
#define LEFT_EDGE 0x01
|
||||||
#define RIGHT_EDGE 0x02
|
#define RIGHT_EDGE 0x02
|
||||||
#define TOP_EDGE 0x04
|
#define TOP_EDGE 0x04
|
||||||
@@ -902,7 +883,7 @@ wWorkspaceUnmapEdge(WScreen *scr)
|
|||||||
void
|
void
|
||||||
wWorkspaceManageEdge(WScreen *scr)
|
wWorkspaceManageEdge(WScreen *scr)
|
||||||
{
|
{
|
||||||
if (!initVDesk && wPreferences.vedge_thickness) {
|
if (!scr->virtual_edges && wPreferences.vedge_thickness) {
|
||||||
int i, j, w;
|
int i, j, w;
|
||||||
int vmask;
|
int vmask;
|
||||||
XSetWindowAttributes attribs;
|
XSetWindowAttributes attribs;
|
||||||
@@ -916,8 +897,6 @@ wWorkspaceManageEdge(WScreen *scr)
|
|||||||
int head;
|
int head;
|
||||||
Window *edges = (Window *)wmalloc(sizeof(Window)*max_edges);
|
Window *edges = (Window *)wmalloc(sizeof(Window)*max_edges);
|
||||||
|
|
||||||
initVDesk = True;
|
|
||||||
|
|
||||||
for (i=0; i<heads; ++i)
|
for (i=0; i<heads; ++i)
|
||||||
hasEdges[i] = ALL_EDGES;
|
hasEdges[i] = ALL_EDGES;
|
||||||
for (i=0; i<heads; ++i) {
|
for (i=0; i<heads; ++i) {
|
||||||
@@ -955,7 +934,7 @@ wWorkspaceManageEdge(WScreen *scr)
|
|||||||
|
|
||||||
for (w = 0; w < scr->workspace_count; w++) {
|
for (w = 0; w < scr->workspace_count; w++) {
|
||||||
/* puts("reset workspace"); */
|
/* puts("reset workspace"); */
|
||||||
wWorkspaceSetViewPort(scr, w, 0, 0);
|
wWorkspaceSetViewport(scr, w, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vmask = CWEventMask|CWOverrideRedirect;
|
vmask = CWEventMask|CWOverrideRedirect;
|
||||||
@@ -1015,7 +994,9 @@ wWorkspaceManageEdge(WScreen *scr)
|
|||||||
scr->virtual_nr_edges = nr_edges;
|
scr->virtual_nr_edges = nr_edges;
|
||||||
scr->virtual_edges = edges;
|
scr->virtual_edges = edges;
|
||||||
|
|
||||||
wWorkspaceMapEdge(scr);
|
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||||
|
XMapWindow(dpy, scr->virtual_edges[i]);
|
||||||
|
}
|
||||||
wWorkspaceRaiseEdge(scr);
|
wWorkspaceRaiseEdge(scr);
|
||||||
|
|
||||||
wfree(hasEdges);
|
wfree(hasEdges);
|
||||||
@@ -1023,37 +1004,33 @@ wWorkspaceManageEdge(WScreen *scr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
static void
|
||||||
wWorkspaceUpdateEdge(WScreen *scr)
|
destroyEdge(WScreen *scr)
|
||||||
{
|
{
|
||||||
if (!initVDesk && wPreferences.vedge_thickness) {
|
if (scr->virtual_edges) {
|
||||||
wWorkspaceManageEdge(scr);
|
|
||||||
} else if (initVDesk) {
|
|
||||||
if (wPreferences.vedge_thickness) {
|
|
||||||
wWorkspaceMapEdge(scr);
|
|
||||||
} else {
|
|
||||||
wWorkspaceUnmapEdge(scr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
wWorkspaceDestroyEdge(WScreen *scr)
|
|
||||||
{
|
|
||||||
if (!initVDesk) {
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||||
XDeleteContext(dpy, scr->virtual_edges[i], wVEdgeContext);
|
XDeleteContext(dpy, scr->virtual_edges[i], wVEdgeContext);
|
||||||
|
XUnmapWindow(dpy, scr->virtual_edges[i]);
|
||||||
XDestroyWindow(dpy, scr->virtual_edges[i]);
|
XDestroyWindow(dpy, scr->virtual_edges[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
wfree(scr->virtual_edges);
|
wfree(scr->virtual_edges);
|
||||||
scr->virtual_edges = NULL;
|
scr->virtual_edges = NULL;
|
||||||
scr->virtual_nr_edges = 0;
|
scr->virtual_nr_edges = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
initVDesk = False;
|
|
||||||
|
void
|
||||||
|
wWorkspaceUpdateEdge(WScreen *scr)
|
||||||
|
{
|
||||||
|
if (wPreferences.vedge_thickness) {
|
||||||
|
destroyEdge(scr);
|
||||||
|
wWorkspaceManageEdge(scr);
|
||||||
|
} else {
|
||||||
|
destroyEdge(scr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,7 +1041,9 @@ wWorkspaceRaiseEdge(WScreen *scr)
|
|||||||
static int toggle = 0;
|
static int toggle = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (wPreferences.vedge_thickness && initVDesk) {
|
if (!scr->virtual_edges)
|
||||||
|
return;
|
||||||
|
|
||||||
if (toggle) {
|
if (toggle) {
|
||||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||||
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
XRaiseWindow(dpy, scr->virtual_edges[i]);
|
||||||
@@ -1077,26 +1056,24 @@ wWorkspaceRaiseEdge(WScreen *scr)
|
|||||||
|
|
||||||
toggle ^= 1;
|
toggle ^= 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceLowerEdge(WScreen *scr)
|
wWorkspaceLowerEdge(WScreen *scr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (wPreferences.vedge_thickness && initVDesk) {
|
|
||||||
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
for (i=0; i<scr->virtual_nr_edges; ++i) {
|
||||||
XLowerWindow(dpy, scr->virtual_edges[i]);
|
XLowerWindow(dpy, scr->virtual_edges[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceResizeViewPort(WScreen *scr, int workspace)
|
wWorkspaceResizeViewport(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
wWorkspaceGetViewPosition(scr, scr->current_workspace, &x, &y);
|
getViewPosition(scr, scr->current_workspace, &x, &y);
|
||||||
wWorkspaceSetViewPort(scr, scr->current_workspace, x, y);
|
wWorkspaceSetViewport(scr, scr->current_workspace, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1191,7 +1168,7 @@ sendConfigureNotify (_delay_configure *delay)
|
|||||||
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
wWorkspaceSetViewport(WScreen *scr, int workspace, int view_x, int view_y)
|
||||||
{
|
{
|
||||||
Bool adjust_flag = False;
|
Bool adjust_flag = False;
|
||||||
int diff_x, diff_y;
|
int diff_x, diff_y;
|
||||||
@@ -1201,7 +1178,7 @@ wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
|||||||
|
|
||||||
wptr = scr->workspaces[workspace];
|
wptr = scr->workspaces[workspace];
|
||||||
|
|
||||||
/*printf("wWorkspaceSetViewPort %d %d\n", view_x, view_y);*/
|
/*printf("wWorkspaceSetViewport %d %d\n", view_x, view_y);*/
|
||||||
|
|
||||||
updateWorkspaceGeometry(scr, workspace, &view_x, &view_y);
|
updateWorkspaceGeometry(scr, workspace, &view_x, &view_y);
|
||||||
|
|
||||||
@@ -1250,12 +1227,6 @@ wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *x, int *y)
|
|
||||||
{
|
|
||||||
*x = scr->workspaces[workspace]->view_x;
|
|
||||||
*y = scr->workspaces[workspace]->view_y;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,11 @@ void wWorkspaceForceChange(WScreen *scr, int workspace);
|
|||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
void wWorkspaceManageEdge(WScreen *scr);
|
void wWorkspaceManageEdge(WScreen *scr);
|
||||||
void wWorkspaceUpdateEdge(WScreen *scr);
|
void wWorkspaceUpdateEdge(WScreen *scr);
|
||||||
void wWorkspaceDestroyEdge(WScreen *scr);
|
|
||||||
void wWorkspaceRaiseEdge(WScreen *scr);
|
void wWorkspaceRaiseEdge(WScreen *scr);
|
||||||
void wWorkspaceLowerEdge(WScreen *scr);
|
void wWorkspaceLowerEdge(WScreen *scr);
|
||||||
void wWorkspaceResizeViewPort(WScreen *scr, int workspace);
|
void wWorkspaceResizeViewport(WScreen *scr, int workspace);
|
||||||
|
Bool wWorkspaceSetViewport(WScreen *scr, int workspace, int view_x, int view_y);
|
||||||
void wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction);
|
void wWorkspaceKeyboardMoveDesktop(WScreen *scr, WMPoint direction);
|
||||||
Bool wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y);
|
|
||||||
Bool wWorkspaceAdjustViewPort(WScreen *scr, int workspace, int view_x, int view_y);
|
|
||||||
void wWorkspaceGetViewPosition(WScreen *scr, int workspace, int *view_x, int *view_y);
|
|
||||||
|
|
||||||
#define VEC_LEFT wmkpoint(-1,0)
|
#define VEC_LEFT wmkpoint(-1,0)
|
||||||
#define VEC_RIGHT wmkpoint(1,0)
|
#define VEC_RIGHT wmkpoint(1,0)
|
||||||
|
|||||||
Reference in New Issue
Block a user