add raise on hover
This commit is contained in:
35
xevents.c
35
xevents.c
@@ -30,6 +30,7 @@
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -219,6 +220,31 @@ xev_handle_propertynotify(XEvent *ee)
|
||||
}
|
||||
}
|
||||
|
||||
static void*
|
||||
delay_raise(void* data)
|
||||
{
|
||||
struct client_ctx *cc;
|
||||
Window *w = (Window*)data;
|
||||
|
||||
int delay = Conf.raisedelay * 1000;
|
||||
usleep(delay);
|
||||
if ((cc = client_find(*w)) != NULL) {
|
||||
if (cc->flags & CLIENT_ACTIVE) {
|
||||
client_raise(cc);
|
||||
}
|
||||
}
|
||||
free(w);
|
||||
|
||||
XEvent e;
|
||||
|
||||
XNextEvent(X_Dpy, &e);
|
||||
if ((e.type - Conf.xrandr_event_base) == RRScreenChangeNotify)
|
||||
xev_handle_randr(&e);
|
||||
else if ((e.type < LASTEvent) && (xev_handlers[e.type] != NULL))
|
||||
(*xev_handlers[e.type])(&e);
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
xev_handle_enternotify(XEvent *ee)
|
||||
{
|
||||
@@ -231,6 +257,15 @@ xev_handle_enternotify(XEvent *ee)
|
||||
|
||||
if ((cc = client_find(e->window)) != NULL)
|
||||
client_set_active(cc);
|
||||
|
||||
if (Conf.raiseonhover) {
|
||||
Window *w;
|
||||
w = (Window*)malloc(sizeof(Window));
|
||||
memcpy(w, &e->window, sizeof(Window));
|
||||
|
||||
pthread_t thread_id;
|
||||
pthread_create(&thread_id, NULL, delay_raise, w);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user