all: update

This commit is contained in:
Martin Duquesnoy 2009-02-21 15:42:20 +01:00
parent 6c5356143f
commit fa990be4e6
5 changed files with 38 additions and 48 deletions

View File

@ -75,10 +75,10 @@ buttonpress(XButtonEvent *ev)
if(ev->window == infobar[selscreen].tags[i]->win) if(ev->window == infobar[selscreen].tags[i]->win)
switch(ev->button) switch(ev->button)
{ {
case Button1: tag_set(i); break; case Button1: tag_set(i); break;
case Button3: tag_transfert(sel, i); break; case Button3: tag_transfert(sel, i); break;
case Button4: tag_set(seltag[selscreen] + 1); break; case Button4: tag_set(seltag[selscreen] + 1); break;
case Button5: tag_set(seltag[selscreen] - 1); break; case Button5: tag_set(seltag[selscreen] - 1); break;
} }
/* Layout button */ /* Layout button */
@ -98,8 +98,8 @@ buttonpress(XButtonEvent *ev)
{ {
switch(ev->button) switch(ev->button)
{ {
case Button1: case Button4: layoutswitch(True); break; case Button1: case Button4: layoutswitch(True); break;
case Button3: case Button5: layoutswitch(False); break; case Button3: case Button5: layoutswitch(False); break;
} }
} }
} }
@ -293,8 +293,9 @@ enternotify(XCrossingEvent *ev)
{ {
Client *c; Client *c;
if(ev->mode != NotifyNormal if((ev->mode != NotifyNormal
|| ev->detail == NotifyInferior) || ev->detail == NotifyInferior)
&& ev->window != ROOT)
return; return;
if((c = client_gb_win(ev->window)) if((c = client_gb_win(ev->window))
@ -482,18 +483,18 @@ getevent(XEvent ev)
switch (ev.type) switch (ev.type)
{ {
case ButtonPress: buttonpress(&ev.xbutton); break; case ButtonPress: buttonpress(&ev.xbutton); break;
case ClientMessage: clientmessageevent(&ev.xclient); break; case ClientMessage: clientmessageevent(&ev.xclient); break;
case ConfigureRequest: configureevent(&ev); break; case ConfigureRequest: configureevent(&ev); break;
case DestroyNotify: destroynotify(&ev.xdestroywindow); break; case DestroyNotify: destroynotify(&ev.xdestroywindow); break;
case EnterNotify: enternotify(&ev.xcrossing); break; case EnterNotify: enternotify(&ev.xcrossing); break;
case Expose: expose(&ev.xexpose); break; case Expose: expose(&ev.xexpose); break;
case FocusIn: focusin(&ev.xfocus); break; case FocusIn: focusin(&ev.xfocus); break;
case KeyPress: keypress(&ev.xkey); break; case KeyPress: keypress(&ev.xkey); break;
case MapRequest: maprequest(&ev.xmaprequest); break; case MapRequest: maprequest(&ev.xmaprequest); break;
case MappingNotify: mappingnotify(&ev.xmapping); break; case MappingNotify: mappingnotify(&ev.xmapping); break;
case PropertyNotify: propertynotify(&ev.xproperty); break; case PropertyNotify: propertynotify(&ev.xproperty); break;
case UnmapNotify: unmapnotify(&ev.xunmap); break; case UnmapNotify: unmapnotify(&ev.xunmap); break;
} }
wait(&st); wait(&st);

View File

@ -132,9 +132,8 @@ init_root(void)
{ {
XSetWindowAttributes at; XSetWindowAttributes at;
at.event_mask = KeyMask|ButtonMask|MouseMask at.event_mask = KeyMask | ButtonMask | MouseMask
|SubstructureRedirectMask|SubstructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask |StructureNotifyMask;
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask;
at.cursor = cursor[CurNormal]; at.cursor = cursor[CurNormal];
XChangeWindowAttributes(dpy, ROOT, CWEventMask | CWCursor, &at); XChangeWindowAttributes(dpy, ROOT, CWEventMask | CWCursor, &at);

View File

@ -506,7 +506,7 @@ uicb_togglemax(uicb_t cmd)
return; return;
} }
/** Set the layout /** Set the layout *CRAP*
* \param cmd uicb_t type * \param cmd uicb_t type
*/ */
void void

View File

@ -40,7 +40,9 @@ mouse_move(Client *c)
{ {
int ocx = c->geo.x; int ocx = c->geo.x;
int ocy = c->geo.y; int ocy = c->geo.y;
int mx = 0, my = 0, dint; int mx = c->geo.x;
int my = c->geo.y;
int dint;
uint duint; uint duint;
Window dw; Window dw;
XRectangle geo = c->geo; XRectangle geo = c->geo;
@ -56,27 +58,25 @@ mouse_move(Client *c)
XQueryPointer(dpy, ROOT, &dw, &dw, &mx, &my, &dint, &dint, &duint); XQueryPointer(dpy, ROOT, &dw, &dw, &mx, &my, &dint, &dint, &duint);
for(;;) do
{ {
XMaskEvent(dpy, MouseMask | ExposureMask | SubstructureRedirectMask, &ev); XMaskEvent(dpy, MouseMask | ExposureMask | SubstructureRedirectMask, &ev);
if(ev.type == ButtonRelease) if(ev.type == MotionNotify)
{
XUngrabPointer(dpy, CurrentTime);
return;
}
else if(ev.type == MotionNotify)
{ {
geo.x = (ocx + (ev.xmotion.x - mx)); geo.x = (ocx + (ev.xmotion.x - mx));
geo.y = (ocy + (ev.xmotion.y - my)); geo.y = (ocy + (ev.xmotion.y - my));
client_moveresize(c, geo, True); client_moveresize(c, geo, True);
XSync(dpy, False);
} }
else if(ev.type == Expose) else if(ev.type == MapRequest
expose(&ev.xexpose); || ev.type == Expose
|| ev.type == ConfigureRequest)
getevent(ev);
} }
while(ev.type != ButtonRelease);
XUngrabPointer(dpy, CurrentTime);
return; return;
} }

View File

@ -77,16 +77,6 @@ color_enlight(ulong col)
return col; return col;
} }
/** Round function
* \param x double type
* \return the round of x
*/
double
round(double x)
{
return (x > 0) ? x + 0.5 : x - 0.5;
}
/** Set the window WM State /** Set the window WM State
* \param win Window target * \param win Window target
* \param state WM State * \param state WM State
@ -110,10 +100,10 @@ _strdup(char const *str)
{ {
char *ret = NULL; char *ret = NULL;
if (str != NULL) if(str != NULL)
{ {
ret = malloc((strlen(str) + 1) * sizeof *ret); ret = malloc((strlen(str) + 1) * sizeof *ret);
if (ret != NULL) if(ret != NULL)
strcpy(ret, str); strcpy(ret, str);
} }