mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 12:58:08 +01:00
multiview and vertical splitview
some bug fixes configurable default font size etc
This commit is contained in:
@@ -456,7 +456,7 @@ wGNOMEProcessClientMessage(XClientMessageEvent *event)
|
||||
WWindow *wwin;
|
||||
Bool done = True;
|
||||
|
||||
scr = wScreenForRootWindow(event->window);
|
||||
scr = wScreenForWindow(event->window);
|
||||
if (scr) {
|
||||
/* generic client messages */
|
||||
if (event->message_type == _XA_WIN_WORKSPACE) {
|
||||
|
||||
@@ -151,6 +151,8 @@ static int ArgCount;
|
||||
extern void EventLoop();
|
||||
extern void StartUp();
|
||||
|
||||
static Bool multiHead = True;
|
||||
|
||||
/* stdi/o for log shell */
|
||||
static int LogStdIn = -1, LogStdOut = -1, LogStdErr = -1;
|
||||
|
||||
@@ -210,7 +212,7 @@ SetupEnvironment(WScreen *scr)
|
||||
char *tmp, *ptr;
|
||||
char buf[16];
|
||||
|
||||
if (wScreenCount > 1) {
|
||||
if (multiHead) {
|
||||
tmp = wmalloc(strlen(DisplayName)+64);
|
||||
sprintf(tmp, "DISPLAY=%s", XDisplayName(DisplayName));
|
||||
ptr = strchr(strchr(tmp, ':'), '.');
|
||||
@@ -540,7 +542,6 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i, restart=0;
|
||||
Bool multiHead = True;
|
||||
char *str;
|
||||
int d, s;
|
||||
#ifdef DEBUG
|
||||
@@ -744,6 +745,9 @@ main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
StartUp(!multiHead);
|
||||
|
||||
if (wScreenCount==1)
|
||||
multiHead = False;
|
||||
|
||||
execInitScript();
|
||||
|
||||
|
||||
213
src/moveres.c
213
src/moveres.c
@@ -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)
|
||||
|
||||
@@ -1407,6 +1407,8 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
||||
dir_data *d = (dir_data*)WMGetFromBag(dirs, i);
|
||||
|
||||
length = strlen(path[d->index])+strlen(d->name)+6;
|
||||
if (stripExtension)
|
||||
length += 7;
|
||||
if (command)
|
||||
length += strlen(command) + 6;
|
||||
buffer = malloc(length);
|
||||
@@ -1415,16 +1417,18 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
||||
path[d->index]);
|
||||
break;
|
||||
}
|
||||
|
||||
buffer[0] = '\0';
|
||||
if (stripExtension)
|
||||
strcat(buffer, "-noext ");
|
||||
|
||||
have_space = strchr(path[d->index], ' ')!=NULL ||
|
||||
strchr(d->name, ' ')!=NULL;
|
||||
if (have_space) {
|
||||
buffer[0] = '"';
|
||||
buffer[1] = 0;
|
||||
strcat(buffer, path[d->index]);
|
||||
} else {
|
||||
strcpy(buffer, path[d->index]);
|
||||
}
|
||||
|
||||
if (have_space)
|
||||
strcat(buffer, "\"");
|
||||
strcat(buffer, path[d->index]);
|
||||
|
||||
strcat(buffer, "/");
|
||||
strcat(buffer, d->name);
|
||||
if (have_space)
|
||||
@@ -1450,7 +1454,7 @@ readMenuDirectory(WScreen *scr, char *title, char **path, char *command)
|
||||
if (command)
|
||||
length += strlen(command);
|
||||
|
||||
buffer = wmalloc(length);
|
||||
buffer = malloc(length);
|
||||
if (!buffer) {
|
||||
wsyserror(_("out of memory while constructing directory menu %s"),
|
||||
path[f->index]);
|
||||
|
||||
@@ -506,6 +506,9 @@
|
||||
#define FRAME_BORDER_COLOR "black"
|
||||
|
||||
|
||||
/* for boxes with high mouse sampling rates (SGI) */
|
||||
#define DELAY_BETWEEN_MOUSE_SAMPLING 10
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user