Mouse: Remove transparent_{move / resize} : new movement/resize mode with revert border.

This commit is contained in:
Martin Duquesnoy 2009-06-14 21:36:45 +02:00
parent c035b52c29
commit af4e77405c
5 changed files with 57 additions and 17 deletions

View File

@ -128,9 +128,6 @@ conf_misc_section(cfg_t *cfg_m)
conf.font = alias_to_str(_strdup(cfg_getstr(cfg_m, "font")));
conf.raisefocus = cfg_getbool(cfg_m, "raisefocus");
conf.raiseswitch = cfg_getbool(cfg_m, "raiseswitch");
conf.resize_transparent = cfg_getbool(cfg_m, "resize_transparent");
conf.move_transparent = cfg_getbool(cfg_m, "move_transparent");
return;
}

View File

@ -42,8 +42,6 @@ cfg_opt_t misc_opts[] =
CFG_STR("font", "sans-9", CFGF_NONE),
CFG_BOOL("raisefocus", cfg_false, CFGF_NONE),
CFG_BOOL("raiseswitch", cfg_true, CFGF_NONE),
CFG_BOOL("resize_transparent", cfg_false, CFGF_NONE),
CFG_BOOL("move_transparent", cfg_false, CFGF_NONE),
CFG_END()
};

View File

@ -259,7 +259,6 @@ configureevent(XConfigureRequestEvent *ev)
CHECK(!c->state_fullscreen);
}
/* Configure Request Part {{{ */
if((c= client_gb_win(ev->window)))
{
if(ev->value_mask & CWX)

View File

@ -44,6 +44,8 @@ mouse_move(Client *c)
Window dw, sw;
Client *sclient;
XRectangle geo = c->geo, ogeo;
XGCValues xgc;
GC gci;
XEvent ev;
if(c->max || c->lmax || c->state_fullscreen || c->state_dock)
@ -56,6 +58,12 @@ mouse_move(Client *c)
None, cursor[CurMove], CurrentTime) != GrabSuccess)
return;
/* Set the GC for the rectangle */
xgc.function = GXinvert;
xgc.subwindow_mode = IncludeInferiors;
xgc.line_width = BORDH;
gci = XCreateGC(dpy, ROOT, GCFunction|GCSubwindowMode|GCLineWidth, &xgc);
XQueryPointer(dpy, ROOT, &dw, &dw, &mx, &my, &dint, &dint, &duint);
do
@ -79,7 +87,7 @@ mouse_move(Client *c)
client_moveresize(sclient, ogeo, False);
}
/* To move a client of one tag to another */
/* To move a client from one tag to another */
XQueryPointer(dpy, infobar[selscreen].bar->win, &dw, &sw, &mx, &my, &dint, &dint, &duint);
for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
@ -96,11 +104,26 @@ mouse_move(Client *c)
/* To move a client normally, in freelayout */
else
{
XDrawRectangle(dpy, ROOT, gci,
geo.x,
geo.y - (TBARH - BORDH),
geo.width,
geo.height + (TBARH - BORDH));
geo.x = (ocx + (ev.xmotion.x - mx));
geo.y = (ocy + (ev.xmotion.y - my));
if(!conf.move_transparent)
client_moveresize(c, geo, False);
/*
* Need to draw 2 times the same rectangle because
* it is draw with the revert color; revert + revert = normal
*/
XDrawRectangle(dpy, ROOT, gci,
(ogeo.x = geo.x),
(ogeo.y = geo.y - (TBARH - BORDH)),
(ogeo.width = geo.width),
(ogeo.height = geo.height + (TBARH - BORDH)));
frame_update(c);
}
}
else if(ev.type == MapRequest
@ -110,9 +133,10 @@ mouse_move(Client *c)
}
while(ev.type != ButtonRelease);
if(!c->tile)
client_moveresize(c, geo, False);
/* One time again to delete all the trace on the window */
XDrawRectangle(dpy, ROOT, gci, ogeo.x, ogeo.y, ogeo.width, ogeo.height);
client_moveresize(c, geo, False);
frame_update(c);
client_update_attributes(c);
XUngrabPointer(dpy, CurrentTime);
@ -126,10 +150,12 @@ mouse_move(Client *c)
void
mouse_resize(Client *c)
{
XRectangle geo = c->geo;
XRectangle geo = c->geo, ogeo = c->geo;
XEvent ev;
Window w;
int d, u, omx, omy;
XGCValues xgc;
GC gci;
float mwf = tags[selscreen][seltag[selscreen]].mwfact;
if(c->max || c->lmax
@ -141,6 +167,13 @@ mouse_resize(Client *c)
if(XGrabPointer(dpy, ROOT, False, MouseMask, GrabModeAsync, GrabModeAsync,
None, cursor[CurResize], CurrentTime) != GrabSuccess)
return;
/* Set the GC for the rectangle */
xgc.function = GXinvert;
xgc.subwindow_mode = IncludeInferiors;
xgc.line_width = BORDH;
gci = XCreateGC(dpy, ROOT, GCFunction|GCSubwindowMode|GCLineWidth, &xgc);
do
{
XMaskEvent(dpy, MouseMask | ExposureMask | SubstructureRedirectMask, &ev);
@ -165,6 +198,12 @@ mouse_resize(Client *c)
}
else if(!c->tile)
{
XDrawRectangle(dpy, ROOT, gci,
geo.x - BORDH / 2,
geo.y - (TBARH - (BORDH / 2)),
geo.width,
geo.height + (TBARH - BORDH));
if((geo.width + ev.xmotion.x_root - omx) > 1)
geo.width += ev.xmotion.x_root - omx;
if((geo.height + ev.xmotion.y_root - omy) > 1)
@ -173,8 +212,13 @@ mouse_resize(Client *c)
omx = ev.xmotion.x_root;
omy = ev.xmotion.y_root;
if(!conf.resize_transparent)
client_moveresize(c, geo, True);
XDrawRectangle(dpy, ROOT, gci,
(ogeo.x = geo.x - BORDH / 2),
(ogeo.y = geo.y - (TBARH - (BORDH / 2))),
(ogeo.width = geo.width),
(ogeo.height = geo.height + (TBARH - BORDH)));
frame_update(c);
XSync(dpy, False);
}
@ -186,7 +230,11 @@ mouse_resize(Client *c)
while(ev.type != ButtonRelease);
if(!c->tile)
{
client_moveresize(c, geo, True);
XDrawRectangle(dpy, ROOT, gci, ogeo.x, ogeo.y, ogeo.width, ogeo.height);
frame_update(c);
}
else
tags[selscreen][seltag[selscreen]].layout.func(c->screen);

View File

@ -279,8 +279,6 @@ typedef struct
char *font;
Bool raisefocus;
Bool raiseswitch;
Bool resize_transparent;
Bool move_transparent;
struct
{
/*