mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 20:38:08 +01:00
Add delay to send configure notify in virtual edge and
fix a bug in move window with keyboard.
This commit is contained in:
457
src/moveres.c
457
src/moveres.c
@@ -1258,249 +1258,266 @@ wKeyboardMoveResizeWindow(WWindow *wwin)
|
|||||||
ww=w;
|
ww=w;
|
||||||
wh=h;
|
wh=h;
|
||||||
while(1) {
|
while(1) {
|
||||||
/*
|
/*
|
||||||
looper.ox=off_x;
|
looper.ox=off_x;
|
||||||
looper.oy=off_y;
|
looper.oy=off_y;
|
||||||
*/
|
*/
|
||||||
WMMaskEvent(dpy, KeyPressMask | ButtonReleaseMask
|
do {
|
||||||
| ButtonPressMask | ExposureMask, &event);
|
WMMaskEvent(dpy, KeyPressMask | ButtonReleaseMask
|
||||||
if (wwin->flags.shaded || scr->selected_windows) {
|
| ButtonPressMask | ExposureMask, &event);
|
||||||
if(scr->selected_windows)
|
if (event.type == Expose) {
|
||||||
drawFrames(wwin,scr->selected_windows,off_x,off_y);
|
WMHandleEvent(&event);
|
||||||
else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);
|
|
||||||
/*** I HATE EDGE RESISTANCE - ]d ***/
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ctrlmode)
|
|
||||||
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
|
|
||||||
|
|
||||||
XUngrabServer(dpy);
|
|
||||||
XSync(dpy, False);
|
|
||||||
|
|
||||||
switch (event.type) {
|
|
||||||
case KeyPress:
|
|
||||||
/* accelerate */
|
|
||||||
if (event.xkey.time - lastTime > 50) {
|
|
||||||
kspeed/=(1 + (event.xkey.time - lastTime)/100);
|
|
||||||
} else {
|
|
||||||
if (kspeed < 20) {
|
|
||||||
kspeed++;
|
|
||||||
}
|
}
|
||||||
}
|
} while (event.type == Expose);
|
||||||
if (kspeed < _KS) kspeed = _KS;
|
|
||||||
lastTime = event.xkey.time;
|
|
||||||
|
|
||||||
if (event.xkey.state & ControlMask && !wwin->flags.shaded) {
|
|
||||||
ctrlmode=1;
|
while (XCheckTypedEvent(dpy, Expose, &event)) {
|
||||||
wUnselectWindows(scr);
|
WMHandleEvent(&event);
|
||||||
|
}
|
||||||
|
if (wwin->flags.shaded || scr->selected_windows) {
|
||||||
|
if(scr->selected_windows)
|
||||||
|
drawFrames(wwin,scr->selected_windows,off_x,off_y);
|
||||||
|
else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);
|
||||||
|
/*** I HATE EDGE RESISTANCE - ]d ***/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ctrlmode=0;
|
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||||
}
|
}
|
||||||
if (event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) {
|
|
||||||
if (ctrlmode)
|
|
||||||
cycleGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh, 0);
|
|
||||||
else
|
|
||||||
cyclePositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
keysym = XLookupKeysym(&event.xkey, 0);
|
if(ctrlmode)
|
||||||
switch (keysym) {
|
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
|
||||||
case XK_Return:
|
|
||||||
done=2;
|
XUngrabServer(dpy);
|
||||||
|
XSync(dpy, False);
|
||||||
|
|
||||||
|
switch (event.type) {
|
||||||
|
case KeyPress:
|
||||||
|
/* accelerate */
|
||||||
|
if (event.xkey.time - lastTime > 50) {
|
||||||
|
kspeed/=(1 + (event.xkey.time - lastTime)/100);
|
||||||
|
} else {
|
||||||
|
if (kspeed < 20) {
|
||||||
|
kspeed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (kspeed < _KS) kspeed = _KS;
|
||||||
|
lastTime = event.xkey.time;
|
||||||
|
|
||||||
|
if (event.xkey.state & ControlMask && !wwin->flags.shaded) {
|
||||||
|
ctrlmode=1;
|
||||||
|
wUnselectWindows(scr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ctrlmode=0;
|
||||||
|
}
|
||||||
|
if (event.xkey.keycode == shiftl || event.xkey.keycode == shiftr) {
|
||||||
|
if (ctrlmode)
|
||||||
|
cycleGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh, 0);
|
||||||
|
else
|
||||||
|
cyclePositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
keysym = XLookupKeysym(&event.xkey, 0);
|
||||||
|
switch (keysym) {
|
||||||
|
case XK_Return:
|
||||||
|
done=2;
|
||||||
|
break;
|
||||||
|
case XK_Escape:
|
||||||
|
done=1;
|
||||||
|
break;
|
||||||
|
case XK_Up:
|
||||||
|
#ifdef XK_KP_Up
|
||||||
|
case XK_KP_Up:
|
||||||
|
#endif
|
||||||
|
case XK_k:
|
||||||
|
if (ctrlmode){
|
||||||
|
if (moment != UP)
|
||||||
|
h = wh;
|
||||||
|
h-=kspeed;
|
||||||
|
moment = UP;
|
||||||
|
if (h < 1) h = 1;
|
||||||
|
}
|
||||||
|
else off_y-=kspeed;
|
||||||
|
break;
|
||||||
|
case XK_Down:
|
||||||
|
#ifdef XK_KP_Down
|
||||||
|
case XK_KP_Down:
|
||||||
|
#endif
|
||||||
|
case XK_j:
|
||||||
|
if (ctrlmode){
|
||||||
|
if (moment != DOWN)
|
||||||
|
h = wh;
|
||||||
|
h+=kspeed;
|
||||||
|
moment = DOWN;
|
||||||
|
}
|
||||||
|
else off_y+=kspeed;
|
||||||
|
break;
|
||||||
|
case XK_Left:
|
||||||
|
#ifdef XK_KP_Left
|
||||||
|
case XK_KP_Left:
|
||||||
|
#endif
|
||||||
|
case XK_h:
|
||||||
|
if (ctrlmode) {
|
||||||
|
if (moment != LEFT)
|
||||||
|
w = ww;
|
||||||
|
w-=kspeed;
|
||||||
|
if (w < 1) w = 1;
|
||||||
|
moment = LEFT;
|
||||||
|
}
|
||||||
|
else off_x-=kspeed;
|
||||||
|
break;
|
||||||
|
case XK_Right:
|
||||||
|
#ifdef XK_KP_Right
|
||||||
|
case XK_KP_Right:
|
||||||
|
#endif
|
||||||
|
case XK_l:
|
||||||
|
if (ctrlmode) {
|
||||||
|
if (moment != RIGHT)
|
||||||
|
w = ww;
|
||||||
|
w+=kspeed;
|
||||||
|
moment = RIGHT;
|
||||||
|
}
|
||||||
|
else off_x+=kspeed;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ww=w;wh=h;
|
||||||
|
wh-=vert_border;
|
||||||
|
wWindowConstrainSize(wwin, &ww, &wh);
|
||||||
|
wh+=vert_border;
|
||||||
|
|
||||||
|
if (wPreferences.ws_cycle){
|
||||||
|
if (src_x + off_x + ww < 20){
|
||||||
|
if(!scr->current_workspace) {
|
||||||
|
wWorkspaceChange(scr, scr->workspace_count-1);
|
||||||
|
}
|
||||||
|
else wWorkspaceChange(scr, scr->current_workspace-1);
|
||||||
|
off_x += scr_width;
|
||||||
|
}
|
||||||
|
else if (src_x + off_x + 20 > scr_width){
|
||||||
|
if(scr->current_workspace == scr->workspace_count-1) {
|
||||||
|
wWorkspaceChange(scr, 0);
|
||||||
|
}
|
||||||
|
else wWorkspaceChange(scr, scr->current_workspace+1);
|
||||||
|
off_x -= scr_width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (src_x + off_x + ww < 20)
|
||||||
|
off_x = 20 - ww - src_x;
|
||||||
|
else if (src_x + off_x + 20 > scr_width)
|
||||||
|
off_x = scr_width - 20 - src_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src_y + off_y + wh < 20) {
|
||||||
|
off_y = 20 - wh - src_y;
|
||||||
|
}
|
||||||
|
else if (src_y + off_y + 20 > scr_height) {
|
||||||
|
off_y = scr_height - 20 - src_y;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case XK_Escape:
|
case ButtonPress:
|
||||||
|
case ButtonRelease:
|
||||||
done=1;
|
done=1;
|
||||||
break;
|
break;
|
||||||
case XK_Up:
|
case Expose:
|
||||||
#ifdef XK_KP_Up
|
WMHandleEvent(&event);
|
||||||
case XK_KP_Up:
|
while (XCheckTypedEvent(dpy, Expose, &event)) {
|
||||||
#endif
|
WMHandleEvent(&event);
|
||||||
case XK_k:
|
|
||||||
if (ctrlmode){
|
|
||||||
if (moment != UP)
|
|
||||||
h = wh;
|
|
||||||
h-=kspeed;
|
|
||||||
moment = UP;
|
|
||||||
if (h < 1) h = 1;
|
|
||||||
}
|
}
|
||||||
else off_y-=kspeed;
|
|
||||||
break;
|
break;
|
||||||
case XK_Down:
|
|
||||||
#ifdef XK_KP_Down
|
|
||||||
case XK_KP_Down:
|
|
||||||
#endif
|
|
||||||
case XK_j:
|
|
||||||
if (ctrlmode){
|
|
||||||
if (moment != DOWN)
|
|
||||||
h = wh;
|
|
||||||
h+=kspeed;
|
|
||||||
moment = DOWN;
|
|
||||||
}
|
|
||||||
else off_y+=kspeed;
|
|
||||||
break;
|
|
||||||
case XK_Left:
|
|
||||||
#ifdef XK_KP_Left
|
|
||||||
case XK_KP_Left:
|
|
||||||
#endif
|
|
||||||
case XK_h:
|
|
||||||
if (ctrlmode) {
|
|
||||||
if (moment != LEFT)
|
|
||||||
w = ww;
|
|
||||||
w-=kspeed;
|
|
||||||
if (w < 1) w = 1;
|
|
||||||
moment = LEFT;
|
|
||||||
}
|
|
||||||
else off_x-=kspeed;
|
|
||||||
break;
|
|
||||||
case XK_Right:
|
|
||||||
#ifdef XK_KP_Right
|
|
||||||
case XK_KP_Right:
|
|
||||||
#endif
|
|
||||||
case XK_l:
|
|
||||||
if (ctrlmode) {
|
|
||||||
if (moment != RIGHT)
|
|
||||||
w = ww;
|
|
||||||
w+=kspeed;
|
|
||||||
moment = RIGHT;
|
|
||||||
}
|
|
||||||
else off_x+=kspeed;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ww=w;wh=h;
|
default:
|
||||||
wh-=vert_border;
|
WMHandleEvent(&event);
|
||||||
wWindowConstrainSize(wwin, &ww, &wh);
|
break;
|
||||||
wh+=vert_border;
|
}
|
||||||
|
|
||||||
if (wPreferences.ws_cycle){
|
XGrabServer(dpy);
|
||||||
if (src_x + off_x + ww < 20){
|
/*xxx*/
|
||||||
if(!scr->current_workspace) {
|
|
||||||
wWorkspaceChange(scr, scr->workspace_count-1);
|
if (wwin->flags.shaded && !scr->selected_windows){
|
||||||
}
|
moveGeometryDisplayCentered(scr, src_x+off_x + w/2, src_y+off_y + h/2);
|
||||||
else wWorkspaceChange(scr, scr->current_workspace-1);
|
} else {
|
||||||
off_x += scr_width;
|
if (ctrlmode) {
|
||||||
}
|
WMUnmapWidget(scr->gview);
|
||||||
else if (src_x + off_x + 20 > scr_width){
|
mapGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||||
if(scr->current_workspace == scr->workspace_count-1) {
|
} else if(!scr->selected_windows) {
|
||||||
wWorkspaceChange(scr, 0);
|
WMUnmapWidget(scr->gview);
|
||||||
}
|
mapPositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||||
else wWorkspaceChange(scr, scr->current_workspace+1);
|
|
||||||
off_x -= scr_width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (src_x + off_x + ww < 20)
|
|
||||||
off_x = 20 - ww - src_x;
|
|
||||||
else if (src_x + off_x + 20 > scr_width)
|
|
||||||
off_x = scr_width - 20 - src_x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (src_y + off_y + wh < 20) {
|
|
||||||
off_y = 20 - wh - src_y;
|
|
||||||
}
|
|
||||||
else if (src_y + off_y + 20 > scr_height) {
|
|
||||||
off_y = scr_height - 20 - src_y;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case ButtonPress:
|
|
||||||
case ButtonRelease:
|
|
||||||
done=1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
WMHandleEvent(&event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
XGrabServer(dpy);
|
if (wwin->flags.shaded || scr->selected_windows) {
|
||||||
/*xxx*/
|
if (scr->selected_windows)
|
||||||
|
drawFrames(wwin,scr->selected_windows,off_x,off_y);
|
||||||
|
else
|
||||||
|
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);
|
||||||
|
} else {
|
||||||
|
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||||
|
}
|
||||||
|
|
||||||
if (wwin->flags.shaded && !scr->selected_windows){
|
|
||||||
moveGeometryDisplayCentered(scr, src_x+off_x + w/2, src_y+off_y + h/2);
|
if (ctrlmode) {
|
||||||
} else {
|
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
|
||||||
if (ctrlmode) {
|
} else if(!scr->selected_windows)
|
||||||
WMUnmapWidget(scr->gview);
|
showPosition(wwin, src_x+off_x, src_y+off_y);
|
||||||
mapGeometryDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
/**/
|
||||||
} else if(!scr->selected_windows) {
|
|
||||||
WMUnmapWidget(scr->gview);
|
if (done) {
|
||||||
mapPositionDisplay(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
scr->keymove_tick=0;
|
||||||
}
|
/*
|
||||||
}
|
WMDeleteTimerWithClientData(&looper);
|
||||||
|
*/
|
||||||
if (wwin->flags.shaded || scr->selected_windows) {
|
|
||||||
if (scr->selected_windows)
|
|
||||||
drawFrames(wwin,scr->selected_windows,off_x,off_y);
|
|
||||||
else
|
|
||||||
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);
|
|
||||||
} else {
|
|
||||||
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ctrlmode) {
|
|
||||||
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
|
|
||||||
} else if(!scr->selected_windows)
|
|
||||||
showPosition(wwin, src_x+off_x, src_y+off_y);
|
|
||||||
/**/
|
|
||||||
|
|
||||||
if(done){
|
|
||||||
scr->keymove_tick=0;
|
|
||||||
/*
|
|
||||||
WMDeleteTimerWithClientData(&looper);
|
|
||||||
*/
|
|
||||||
if (wwin->flags.shaded || scr->selected_windows) {
|
if (wwin->flags.shaded || scr->selected_windows) {
|
||||||
if(scr->selected_windows)
|
if(scr->selected_windows)
|
||||||
drawFrames(wwin,scr->selected_windows,off_x,off_y);
|
drawFrames(wwin,scr->selected_windows,off_x,off_y);
|
||||||
else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);
|
else drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, w, h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
drawTransparentFrame(wwin, src_x+off_x, src_y+off_y, ww, wh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrlmode) {
|
if (ctrlmode) {
|
||||||
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
|
showGeometry(wwin, src_x+off_x, src_y+off_y, src_x+off_x+ww, src_y+off_y+wh,0);
|
||||||
WMUnmapWidget(scr->gview);
|
WMUnmapWidget(scr->gview);
|
||||||
} else
|
} else
|
||||||
WMUnmapWidget(scr->gview);
|
WMUnmapWidget(scr->gview);
|
||||||
|
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
|
||||||
XUngrabPointer(dpy, CurrentTime);
|
|
||||||
XUngrabServer(dpy);
|
|
||||||
|
|
||||||
if(done==2) {
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
if (wwin->flags.shaded || scr->selected_windows) {
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
if (!scr->selected_windows) {
|
XUngrabServer(dpy);
|
||||||
wWindowMove(wwin, src_x+off_x, src_y+off_y);
|
|
||||||
wWindowSynthConfigureNotify(wwin);
|
if(done==2) {
|
||||||
} else {
|
if (wwin->flags.shaded || scr->selected_windows) {
|
||||||
int i;
|
if (!scr->selected_windows) {
|
||||||
WMBag *bag = scr->selected_windows;
|
wWindowMove(wwin, src_x+off_x, src_y+off_y);
|
||||||
doWindowMove(wwin,scr->selected_windows,off_x,off_y);
|
wWindowSynthConfigureNotify(wwin);
|
||||||
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
} else {
|
||||||
wWindowSynthConfigureNotify(WMGetFromBag(bag, i));
|
int i;
|
||||||
}
|
WMBag *bag = scr->selected_windows;
|
||||||
}
|
doWindowMove(wwin,scr->selected_windows,off_x,off_y);
|
||||||
} else {
|
for (i = 0; i < WMGetBagItemCount(bag); i++) {
|
||||||
if (wwin->client.width != ww)
|
wWindowSynthConfigureNotify(WMGetFromBag(bag, i));
|
||||||
wwin->flags.user_changed_width = 1;
|
}
|
||||||
|
}
|
||||||
if (wwin->client.height != wh - vert_border)
|
} else {
|
||||||
wwin->flags.user_changed_height = 1;
|
if (wwin->client.width != ww)
|
||||||
|
wwin->flags.user_changed_width = 1;
|
||||||
wWindowConfigure(wwin, src_x+off_x, src_y+off_y,
|
|
||||||
ww, wh - vert_border);
|
if (wwin->client.height != wh - vert_border)
|
||||||
wWindowSynthConfigureNotify(wwin);
|
wwin->flags.user_changed_height = 1;
|
||||||
}
|
|
||||||
wWindowChangeWorkspace(wwin, scr->current_workspace);
|
wWindowConfigure(wwin, src_x+off_x, src_y+off_y,
|
||||||
wSetFocusTo(scr, wwin);
|
ww, wh - vert_border);
|
||||||
}
|
wWindowSynthConfigureNotify(wwin);
|
||||||
return 1;
|
}
|
||||||
}
|
wWindowChangeWorkspace(wwin, scr->current_workspace);
|
||||||
|
wSetFocusTo(scr, wwin);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* workspace.c- Workspace management
|
/* workspace.c- Workspace management
|
||||||
*
|
*
|
||||||
* Window Maker window manager
|
* Window Maker window manager
|
||||||
*
|
*
|
||||||
* Copyright (c) 1997, 1998 Alfredo K. Kojima
|
* Copyright (c) 1997, 1998 Alfredo K. Kojima
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
* USA.
|
* USA.
|
||||||
*/
|
*/
|
||||||
#include "wconfig.h"
|
#include "wconfig.h"
|
||||||
@@ -72,7 +72,7 @@ make_keys()
|
|||||||
{
|
{
|
||||||
if (dWorkspaces!=NULL)
|
if (dWorkspaces!=NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dWorkspaces = PLMakeString("Workspaces");
|
dWorkspaces = PLMakeString("Workspaces");
|
||||||
dName = PLMakeString("Name");
|
dName = PLMakeString("Name");
|
||||||
dClip = PLMakeString("Clip");
|
dClip = PLMakeString("Clip");
|
||||||
@@ -94,7 +94,7 @@ wWorkspaceNew(WScreen *scr)
|
|||||||
{
|
{
|
||||||
WWorkspace *wspace, **list;
|
WWorkspace *wspace, **list;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (scr->workspace_count < MAX_WORKSPACES) {
|
if (scr->workspace_count < MAX_WORKSPACES) {
|
||||||
scr->workspace_count++;
|
scr->workspace_count++;
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ wWorkspaceDelete(WScreen *scr, int workspace)
|
|||||||
wDockDestroy(scr->workspaces[workspace]->clip);
|
wDockDestroy(scr->workspaces[workspace]->clip);
|
||||||
scr->workspaces[workspace]->clip = NULL;
|
scr->workspaces[workspace]->clip = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
list = wmalloc(sizeof(WWorkspace*)*(scr->workspace_count-1));
|
list = wmalloc(sizeof(WWorkspace*)*(scr->workspace_count-1));
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i=0; i<scr->workspace_count; i++) {
|
for (i=0; i<scr->workspace_count; i++) {
|
||||||
@@ -264,7 +264,7 @@ hideWorkpaceName(void *data)
|
|||||||
RImage *img = RCloneImage(scr->workspace_name_data->back);
|
RImage *img = RCloneImage(scr->workspace_name_data->back);
|
||||||
Pixmap pix;
|
Pixmap pix;
|
||||||
|
|
||||||
scr->workspace_name_timer =
|
scr->workspace_name_timer =
|
||||||
WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideWorkpaceName,
|
WMAddTimerHandler(WORKSPACE_NAME_FADE_DELAY, hideWorkpaceName,
|
||||||
scr);
|
scr);
|
||||||
|
|
||||||
@@ -373,7 +373,7 @@ showWorkspaceName(WScreen *scr, int workspace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
|
XSetForeground(dpy, scr->draw_gc, scr->white_pixel);
|
||||||
WMDrawString(scr->wmscreen, text, scr->draw_gc, scr->workspace_name_font,
|
WMDrawString(scr->wmscreen, text, scr->draw_gc, scr->workspace_name_font,
|
||||||
2, 2, scr->workspaces[workspace]->name,
|
2, 2, scr->workspaces[workspace]->name,
|
||||||
strlen(scr->workspaces[workspace]->name));
|
strlen(scr->workspaces[workspace]->name));
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
@@ -487,7 +487,7 @@ void
|
|||||||
wWorkspaceForceChange(WScreen *scr, int workspace)
|
wWorkspaceForceChange(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
WWindow *tmp, *foc=NULL, *foc2=NULL;
|
WWindow *tmp, *foc=NULL, *foc2=NULL;
|
||||||
|
|
||||||
if (workspace >= MAX_WORKSPACES || workspace < 0)
|
if (workspace >= MAX_WORKSPACES || workspace < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -510,9 +510,9 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
|| tmp->flags.changing_workspace) {
|
|| tmp->flags.changing_workspace) {
|
||||||
foc = tmp;
|
foc = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* foc2 = tmp; will fix annoyance with gnome panel
|
/* foc2 = tmp; will fix annoyance with gnome panel
|
||||||
* but will create annoyance for every other application
|
* but will create annoyance for every other application
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
@@ -521,11 +521,11 @@ wWorkspaceForceChange(WScreen *scr, int workspace)
|
|||||||
if ((tmp->flags.mapped||tmp->flags.shaded)
|
if ((tmp->flags.mapped||tmp->flags.shaded)
|
||||||
&& !IS_OMNIPRESENT(tmp)
|
&& !IS_OMNIPRESENT(tmp)
|
||||||
&& !tmp->flags.changing_workspace) {
|
&& !tmp->flags.changing_workspace) {
|
||||||
|
|
||||||
wWindowUnmap(tmp);
|
wWindowUnmap(tmp);
|
||||||
}
|
}
|
||||||
/* also unmap miniwindows not on this workspace */
|
/* also unmap miniwindows not on this workspace */
|
||||||
if (tmp->flags.miniaturized && !IS_OMNIPRESENT(tmp)
|
if (tmp->flags.miniaturized && !IS_OMNIPRESENT(tmp)
|
||||||
&& tmp->icon) {
|
&& tmp->icon) {
|
||||||
if (!wPreferences.sticky_icons) {
|
if (!wPreferences.sticky_icons) {
|
||||||
XUnmapWindow(dpy, tmp->icon->core->window);
|
XUnmapWindow(dpy, tmp->icon->core->window);
|
||||||
@@ -744,13 +744,30 @@ void updateWorkspaceGeometry(WScreen *scr, int workspace, int *view_x, int *view
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 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;
|
||||||
|
static _delay_configure delay_configure = {NULL, 0};
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -780,12 +797,16 @@ Bool wWorkspaceSetViewPort(WScreen *scr, int workspace, int view_x, int view_y)
|
|||||||
scr->workspaces[workspace]->view_y = view_y;
|
scr->workspaces[workspace]->view_y = view_y;
|
||||||
|
|
||||||
|
|
||||||
for( wwin = scr->focused_window; wwin; wwin = wwin->prev) {
|
for (wwin = scr->focused_window; wwin; wwin = wwin->prev) {
|
||||||
if (wwin->frame->workspace == workspace) {
|
if (wwin->frame->workspace == workspace) {
|
||||||
wWindowMove(wwin, wwin->frame_x + diff_x, wwin->frame_y + diff_y);
|
wWindowMove(wwin, wwin->frame_x + diff_x, wwin->frame_y + diff_y);
|
||||||
wWindowSynthConfigureNotify(wwin);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (1) { /* if delay*/
|
||||||
|
delay_configure.delay_count++;
|
||||||
|
delay_configure.wwin = scr->focused_window;
|
||||||
|
WMAddTimerHandler(200, (WMCallback *)_sendConfigureNotify, &delay_configure);
|
||||||
|
}
|
||||||
|
|
||||||
return adjust_flag;
|
return adjust_flag;
|
||||||
}
|
}
|
||||||
@@ -808,7 +829,7 @@ switchWSCommand(WMenu *menu, WMenuEntry *entry)
|
|||||||
static void
|
static void
|
||||||
deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
deleteWSCommand(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
wWorkspaceDelete(menu->frame->screen_ptr,
|
wWorkspaceDelete(menu->frame->screen_ptr,
|
||||||
menu->frame->screen_ptr->workspace_count-1);
|
menu->frame->screen_ptr->workspace_count-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -823,14 +844,14 @@ newWSCommand(WMenu *menu, WMenuEntry *foo)
|
|||||||
/* autochange workspace*/
|
/* autochange workspace*/
|
||||||
if (ws>=0)
|
if (ws>=0)
|
||||||
wWorkspaceChange(menu->frame->screen_ptr, ws);
|
wWorkspaceChange(menu->frame->screen_ptr, ws);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (ws<9) {
|
if (ws<9) {
|
||||||
int kcode;
|
int kcode;
|
||||||
if (wKeyBindings[WKBD_WORKSPACE1+ws]) {
|
if (wKeyBindings[WKBD_WORKSPACE1+ws]) {
|
||||||
kcode = wKeyBindings[WKBD_WORKSPACE1+ws]->keycode;
|
kcode = wKeyBindings[WKBD_WORKSPACE1+ws]->keycode;
|
||||||
entry->rtext =
|
entry->rtext =
|
||||||
wstrdup(XKeysymToString(XKeycodeToKeysym(dpy, kcode, 0)));
|
wstrdup(XKeysymToString(XKeycodeToKeysym(dpy, kcode, 0)));
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
@@ -841,10 +862,10 @@ static char*
|
|||||||
cropline(char *line)
|
cropline(char *line)
|
||||||
{
|
{
|
||||||
char *start, *end;
|
char *start, *end;
|
||||||
|
|
||||||
if (strlen(line)==0)
|
if (strlen(line)==0)
|
||||||
return line;
|
return line;
|
||||||
|
|
||||||
start = line;
|
start = line;
|
||||||
end = &(line[strlen(line)])-1;
|
end = &(line[strlen(line)])-1;
|
||||||
while (isspace(*line) && *line!=0) line++;
|
while (isspace(*line) && *line!=0) line++;
|
||||||
@@ -898,7 +919,7 @@ wWorkspaceRename(WScreen *scr, int workspace, char *name)
|
|||||||
|
|
||||||
if (scr->clip_icon)
|
if (scr->clip_icon)
|
||||||
wClipIconPaint(scr->clip_icon);
|
wClipIconPaint(scr->clip_icon);
|
||||||
|
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
wGNOMEUpdateWorkspaceNamesHint(scr);
|
wGNOMEUpdateWorkspaceNamesHint(scr);
|
||||||
#endif
|
#endif
|
||||||
@@ -931,10 +952,10 @@ wWorkspaceMenuMake(WScreen *scr, Bool titled)
|
|||||||
wwarning(_("could not create Workspace menu"));
|
wwarning(_("could not create Workspace menu"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* callback to be called when an entry is edited */
|
/* callback to be called when an entry is edited */
|
||||||
wsmenu->on_edit = onMenuEntryEdited;
|
wsmenu->on_edit = onMenuEntryEdited;
|
||||||
|
|
||||||
wMenuAddCallback(wsmenu, _("New"), newWSCommand, NULL);
|
wMenuAddCallback(wsmenu, _("New"), newWSCommand, NULL);
|
||||||
wMenuAddCallback(wsmenu, _("Destroy Last"), deleteWSCommand, NULL);
|
wMenuAddCallback(wsmenu, _("Destroy Last"), deleteWSCommand, NULL);
|
||||||
|
|
||||||
@@ -976,8 +997,8 @@ wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wMenuRealize(menu);
|
wMenuRealize(menu);
|
||||||
|
|
||||||
for (i=0; i<scr->workspace_count; i++) {
|
for (i=0; i<scr->workspace_count; i++) {
|
||||||
menu->entries[i+2]->flags.indicator_on = 0;
|
menu->entries[i+2]->flags.indicator_on = 0;
|
||||||
}
|
}
|
||||||
menu->entries[scr->current_workspace+2]->flags.indicator_on = 1;
|
menu->entries[scr->current_workspace+2]->flags.indicator_on = 1;
|
||||||
@@ -993,7 +1014,7 @@ wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu)
|
|||||||
/* if menu got unreachable, bring it to a visible place */
|
/* if menu got unreachable, bring it to a visible place */
|
||||||
if (menu->frame_x < tmp - (int)menu->frame->core->width)
|
if (menu->frame_x < tmp - (int)menu->frame->core->width)
|
||||||
wMenuMove(menu, tmp - (int)menu->frame->core->width, menu->frame_y, False);
|
wMenuMove(menu, tmp - (int)menu->frame->core->width, menu->frame_y, False);
|
||||||
|
|
||||||
wMenuPaint(menu);
|
wMenuPaint(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1046,7 +1067,7 @@ wWorkspaceRestoreState(WScreen *scr)
|
|||||||
|
|
||||||
if (!parr)
|
if (!parr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wscount = scr->workspace_count;
|
wscount = scr->workspace_count;
|
||||||
for (i=0; i < WMIN(PLGetNumberOfElements(parr), MAX_WORKSPACES); i++) {
|
for (i=0; i < WMIN(PLGetNumberOfElements(parr), MAX_WORKSPACES); i++) {
|
||||||
wks_state = PLGetArrayElement(parr, i);
|
wks_state = PLGetArrayElement(parr, i);
|
||||||
|
|||||||
Reference in New Issue
Block a user