removed border cursor displaying on motion event, we got Alt-Button{1,3}, we don't want redundant behavior

This commit is contained in:
Anselm R. Garbe 2006-03-22 17:26:39 +01:00
parent 9708b26a9a
commit d3fbdfac1b
5 changed files with 10 additions and 90 deletions

View File

@ -45,7 +45,7 @@ alloc_client(Window w, XWindowAttributes *wa)
}
fwa.override_redirect = 1;
fwa.background_pixmap = ParentRelative;
fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask | ButtonPressMask | PointerMotionMask;
fwa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | ExposureMask | ButtonPressMask;
c->framewin = XCreateWindow(dpy, root, c->rect.x, c->rect.y,
c->rect.width + 2 * def.border, c->rect.height + def.border + bar_height(), 0,

View File

@ -18,7 +18,6 @@ static void handle_expose(XEvent * e);
static void handle_keypress(XEvent * e);
static void handle_keymapnotify(XEvent * e);
static void handle_maprequest(XEvent * e);
static void handle_motionnotify(XEvent * e);
static void handle_propertynotify(XEvent * e);
static void handle_unmapnotify(XEvent * e);
@ -39,7 +38,6 @@ init_x_event_handler()
handler[KeyPress] = handle_keypress;
handler[KeymapNotify] = handle_keymapnotify;
handler[MapRequest] = handle_maprequest;
handler[MotionNotify] = handle_motionnotify;
handler[PropertyNotify] = handle_propertynotify;
handler[UnmapNotify] = handle_unmapnotify;
}
@ -72,15 +70,10 @@ handle_buttonpress(XEvent *e)
}
else if((c = win2clientframe(ev->window))) {
if(ev->button == Button1) {
Align align = xy2align(&c->rect, ev->x, ev->y);
if(sel_client() != c) {
focus(c);
return;
}
if(align == CENTER)
mouse_move(c);
else
mouse_resize(c, align);
}
if(c->nframe) {
snprintf(buf, sizeof(buf), "ClientClick %d %d\n", frame2index(c->frame[c->sel]) + 1, ev->button);
@ -90,19 +83,20 @@ handle_buttonpress(XEvent *e)
else if((c = win2client(ev->window))) {
ev->state &= valid_mask;
if(ev->state & Mod1Mask) {
Align align = xy2align(&c->rect, ev->x, ev->y);
focus(c);
switch (ev->button) {
case Button1:
focus(c);
mouse_move(c);
break;
case Button3:
focus(c);
case Button1:
mouse_move(c);
break;
case Button3:
{
Align align = xy2align(&c->rect, ev->x, ev->y);
if(align == CENTER)
mouse_move(c);
else
mouse_resize(c, align);
break;
}
break;
}
}
else if(ev->button == Button1)
@ -240,19 +234,6 @@ handle_maprequest(XEvent *e)
manage_client(alloc_client(ev->window, &wa));
}
static void
handle_motionnotify(XEvent *e)
{
Client *c = win2clientframe(e->xmotion.window);
if(c) {
Cursor cur = cursor4motion(c, e->xmotion.x, e->xmotion.y);
if(cur == cursor[CurUnknown])
XUndefineCursor(dpy, c->framewin);
else
XDefineCursor(dpy, c->framewin, cur);
}
}
static void
handle_propertynotify(XEvent *e)
{

View File

@ -9,48 +9,6 @@
#include "wm.h"
Cursor
cursor4motion(Client *c, int x, int y)
{
Frame *f = c->frame[c->sel];
int n, e, w, s, tn, te, tw, ts;
if(!def.border < 2)
return cursor[CurNormal];
/* rectangle attributes of client are used */
w = x < def.border - 1;
e = x >= f->rect.width - (def.border - 1);
n = y < def.border;
s = y >= f->rect.height - (def.border - 1);
tw = x < bar_height();
te = x > f->rect.width - bar_height();
tn = y < bar_height();
ts = s > f->rect.height - bar_height();
if((w && n) || (w && tn) || (n && tw))
return cursor[CurNW];
else if((e && n) || (e && tn) || (n && te))
return cursor[CurNE];
else if((w && s) || (w && ts) || (s && tw))
return cursor[CurSW];
else if((e && s) || (e && ts) || (s && te))
return cursor[CurSE];
else if(w)
return cursor[CurW];
else if(e)
return cursor[CurE];
else if(n)
return cursor[CurN];
else if(s)
return cursor[CurS];
if(tn)
return cursor[CurNormal];
return cursor[CurUnknown];
}
Align
xy2align(XRectangle *rect, int x, int y)
{

View File

@ -139,18 +139,9 @@ init_atoms()
static void
init_cursors()
{
cursor[CurUnknown] = XCreateFontCursor(dpy, XC_cross);
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
cursor[CurW] = XCreateFontCursor(dpy, XC_left_side);
cursor[CurE] = XCreateFontCursor(dpy, XC_right_side);
cursor[CurN] = XCreateFontCursor(dpy, XC_top_side);
cursor[CurS] = XCreateFontCursor(dpy, XC_bottom_side);
cursor[CurNW] = XCreateFontCursor(dpy, XC_top_left_corner);
cursor[CurNE] = XCreateFontCursor(dpy, XC_top_right_corner);
cursor[CurSW] = XCreateFontCursor(dpy, XC_bottom_left_corner);
cursor[CurSE] = XCreateFontCursor(dpy, XC_bottom_right_corner);
}
static void

View File

@ -27,18 +27,9 @@ enum {
/* Cursor */
enum {
CurUnknown,
CurNormal,
CurResize,
CurMove,
CurW,
CurE,
CurN,
CurS,
CurNW,
CurNE,
CurSW,
CurSE,
CurLast
};
@ -284,7 +275,6 @@ void init_lock_modifiers();
/* mouse.c */
void mouse_resize(Client *c, Align align);
void mouse_move(Client *c);
Cursor cursor4motion(Client *c, int x, int y);
Align xy2align(XRectangle *rect, int x, int y);
void drop_move(Client *c, XRectangle *new, XPoint *pt);
void grab_mouse(Window w, unsigned long mod, unsigned int button);