1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

multiview and vertical splitview

some bug fixes
configurable default font size
etc
This commit is contained in:
kojima
1999-10-27 22:32:12 +00:00
parent 4e65111750
commit 94f4483dbd
34 changed files with 2756 additions and 1399 deletions

View File

@@ -67,6 +67,9 @@ extern Atom _XA_WM_PROTOCOLS;
void
wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
unsigned int *height)
@@ -77,6 +80,32 @@ wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
}
/*
*----------------------------------------------------------------------
* checkMouseSamplingRate-
* For lowering the mouse motion sampling rate for machines where
* it's too high (SGIs). If it returns False then the event should be
* ignored.
*----------------------------------------------------------------------
*/
static Bool
checkMouseSamplingRate(XEvent *ev)
{
static Time previousMotion = 0;
if (ev->type == MotionNotify) {
if (ev->xmotion.time - previousMotion < DELAY_BETWEEN_MOUSE_SAMPLING) {
return False;
} else {
previousMotion = ev->xmotion.time;
}
}
return True;
}
/*
*----------------------------------------------------------------------
* moveGeometryDisplayCentered
@@ -1592,6 +1621,8 @@ wMouseMoveWindow(WWindow *wwin, XEvent *ev)
if (event.type == MotionNotify) {
/* compress MotionNotify events */
while (XCheckMaskEvent(dpy, ButtonMotionMask, &event)) ;
if (!checkMouseSamplingRate(&event))
continue;
}
}
switch (event.type) {
@@ -1876,6 +1907,10 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
while (1) {
WMMaskEvent(dpy, KeyPressMask | ButtonMotionMask | ButtonReleaseMask
| ButtonPressMask | ExposureMask, &event);
if (!checkMouseSamplingRate(&event))
continue;
switch (event.type) {
case KeyPress:
showGeometry(wwin, fx, fy, fx + fw, fy + fh, res);
@@ -2080,13 +2115,19 @@ wSelectWindows(WScreen *scr, XEvent *ev)
int xp = ev->xbutton.x_root;
int yp = ev->xbutton.y_root;
int w = 0, h = 0;
int x = xp, y = yp;
int nx = xp, ny = yp, ox = xp, oy = yp, update_selection = 0;
XSegment segments[8]; /* 8 segments is the most possible */
/* it may be beneficial to use */
/* XDrawRectangle for 8 segment case */
int nsegs = 0;
#ifdef DEBUG
puts("Selecting windows");
#endif
if (XGrabPointer(dpy, scr->root_win, False, ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
if (XGrabPointer(dpy, scr->root_win, True, PointerMotionMask
| ButtonMotionMask | ButtonReleaseMask | ButtonPressMask
| EnterWindowMask | LeaveWindowMask , GrabModeAsync,
GrabModeAsync, None, wCursor[WCUR_DEFAULT],
CurrentTime) != Success) {
return;
@@ -2095,29 +2136,36 @@ wSelectWindows(WScreen *scr, XEvent *ev)
wUnselectWindows(scr);
XDrawRectangle(dpy, root, gc, xp, yp, w, h);
while (1) {
WMMaskEvent(dpy, ButtonReleaseMask | PointerMotionMask
| ButtonPressMask, &event);
update_selection = 0;
WMMaskEvent(dpy, ButtonReleaseMask | PointerMotionMask | LeaveWindowMask
| EnterWindowMask | ButtonPressMask,
&event);
if (!checkMouseSamplingRate(&event))
continue;
nsegs = 0;
switch (event.type) {
case LeaveNotify:
case EnterNotify:
#ifdef DEBUG
dbputs("got Enter/LeaveNotify in selection");
#endif
nx = event.xcrossing.x_root;
ny = event.xcrossing.y_root;
update_selection = 1;
break;
case MotionNotify:
XDrawRectangle(dpy, root, gc, x, y, w, h);
x = event.xmotion.x_root;
if (x < xp) {
w = xp - x;
} else {
w = x - xp;
x = xp;
}
y = event.xmotion.y_root;
if (y < yp) {
h = yp - y;
} else {
h = y - yp;
y = yp;
}
XDrawRectangle(dpy, root, gc, x, y, w, h);
#ifdef DEBUG
dbputs("got motionevent in selection");
#endif
nx = event.xmotion.x_root;
ny = event.xmotion.y_root;
update_selection = 1;
break;
case ButtonPress:
@@ -2127,10 +2175,22 @@ wSelectWindows(WScreen *scr, XEvent *ev)
if (event.xbutton.button != ev->xbutton.button)
break;
XDrawRectangle(dpy, root, gc, x, y, w, h);
if(nx > xp) w = nx - xp;
else if(nx < xp) {
w = xp - nx;
xp = nx;
} else w = 0;
if(ny > yp) h = ny - yp;
else if(ny < yp) {
h = yp - ny;
yp = ny;
} else h = 0;
XDrawRectangle(dpy, root, gc, xp, yp, w, h);
XUngrabServer(dpy);
XUngrabPointer(dpy, CurrentTime);
selectWindowsInside(scr, x, y, x + w, y + h);
selectWindowsInside(scr, xp, yp, w + xp, h + yp);
#ifdef KWM_HINTS
wKWMSelectRootRegion(scr, x, y, w, h,
@@ -2138,14 +2198,113 @@ wSelectWindows(WScreen *scr, XEvent *ev)
#endif /* KWM_HINTS */
#ifdef DEBUG
puts("End window selection");
dbputs("End window selection");
#endif
return;
default:
#ifdef DEBUG
dbputs("unknown event");
dbprintf("type: %u\n", event.type);
#endif
WMHandleEvent(&event);
break;
}
if(update_selection) {
/* stuff to change for movement along X axis */
if(nx != ox) {
/* erase old vertical line */
/* only if old vertical line exists */
/* and only if its different from other vertical line */
if(yp != oy && ox != xp) {
segments[nsegs].x1 = ox;
segments[nsegs].y1 = yp;
segments[nsegs].x2 = ox;
segments[nsegs].y2 = oy;
nsegs++;
}
/* draw new vertical line */
/* only if new vertical line exists */
/* and only if its different from the other vertical line */
if(yp != ny && nx != xp) {
segments[nsegs].x1 = nx;
segments[nsegs].y1 = yp;
segments[nsegs].x2 = nx;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along x axis from old to new on ny horizontal */
/* only if our mouse doesnt move along Y, otherwise this gets */
/* done elsewhere */
if(ny == oy && nx != xp) {
segments[nsegs].x1 = ox;
segments[nsegs].y1 = ny;
segments[nsegs].x2 = nx;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along x axis from old to new on yp horizontal */
segments[nsegs].x1 = nx;
segments[nsegs].y1 = yp;
segments[nsegs].x2 = ox;
segments[nsegs].y2 = yp;
nsegs++;
}
/* now for stuff to change for movement along Y axis */
if(ny != oy) {
/* erase old horizontal line */
/* only if old horizontal line exists */
/* and only if its different from other horizontal line */
if(xp != ox && oy != yp) {
segments[nsegs].x1 = ox;
segments[nsegs].y1 = oy;
segments[nsegs].x2 = xp;
segments[nsegs].y2 = oy;
nsegs++;
}
/* draw new horizontal line */
/* only if horizontal line exists, and if its different from other */
if(xp != nx && ny != yp) {
segments[nsegs].x1 = nx;
segments[nsegs].y1 = ny;
segments[nsegs].x2 = xp;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along y axis from old to new on nx vertical */
/* only if no movement along x axis */
/* and only if we dont have duplicate lines */
if(nx == ox && nx != xp) {
segments[nsegs].x1 = nx;
segments[nsegs].y1 = oy;
segments[nsegs].x2 = nx;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along y axis from old to new on xp vertical */
segments[nsegs].x1 = xp;
segments[nsegs].y1 = oy;
segments[nsegs].x2 = xp;
segments[nsegs].y2 = ny;
nsegs++;
}
ox = nx;
oy = ny;
XDrawSegments(dpy, root, gc, segments, nsegs);
}
}
}
#endif /* !LITE */
@@ -2188,6 +2347,10 @@ InteractivePlaceWindow(WWindow *wwin, int *x_ret, int *y_ret,
while (1) {
WMMaskEvent(dpy, PointerMotionMask|ButtonPressMask|ExposureMask|KeyPressMask,
&event);
if (!checkMouseSamplingRate(&event))
continue;
switch (event.type) {
case KeyPress:
if ((event.xkey.keycode == shiftl)