add raise on hover
This commit is contained in:
2
calmwm.h
2
calmwm.h
@@ -314,6 +314,8 @@ struct conf {
|
|||||||
int bwidth;
|
int bwidth;
|
||||||
int mamount;
|
int mamount;
|
||||||
int scalefactor;
|
int scalefactor;
|
||||||
|
int raiseonhover;
|
||||||
|
int raisedelay;
|
||||||
int snapdist;
|
int snapdist;
|
||||||
int htile;
|
int htile;
|
||||||
int vtile;
|
int vtile;
|
||||||
|
|||||||
2
conf.c
2
conf.c
@@ -289,6 +289,8 @@ conf_init(struct conf *c)
|
|||||||
c->bwidth = 1;
|
c->bwidth = 1;
|
||||||
c->mamount = 1;
|
c->mamount = 1;
|
||||||
c->scalefactor = 10;
|
c->scalefactor = 10;
|
||||||
|
c->raiseonhover = 1;
|
||||||
|
c->raisedelay = 250;
|
||||||
c->htile = 50;
|
c->htile = 50;
|
||||||
c->vtile = 50;
|
c->vtile = 50;
|
||||||
c->snapdist = 0;
|
c->snapdist = 0;
|
||||||
|
|||||||
14
parse.y
14
parse.y
@@ -71,7 +71,7 @@ typedef struct {
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
|
%token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
|
||||||
%token FONTNAME STICKY GAP
|
%token FONTNAME STICKY RAISEONHOVER RAISEONHOVERDELAY GAP
|
||||||
%token AUTOGROUP COMMAND IGNORE WM
|
%token AUTOGROUP COMMAND IGNORE WM
|
||||||
%token YES NO BORDERWIDTH MOVEAMOUNT SCALEFACTOR HTILE VTILE
|
%token YES NO BORDERWIDTH MOVEAMOUNT SCALEFACTOR HTILE VTILE
|
||||||
%token COLOR SNAPDIST
|
%token COLOR SNAPDIST
|
||||||
@@ -128,6 +128,16 @@ main : FONTNAME STRING {
|
|||||||
| STICKY yesno {
|
| STICKY yesno {
|
||||||
conf->stickygroups = $2;
|
conf->stickygroups = $2;
|
||||||
}
|
}
|
||||||
|
| RAISEONHOVER yesno {
|
||||||
|
conf->raiseonhover = $2;
|
||||||
|
}
|
||||||
|
| RAISEONHOVERDELAY NUMBER {
|
||||||
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
|
yyerror("invalid delay");
|
||||||
|
YYERROR;
|
||||||
|
}
|
||||||
|
conf->raisedelay = $2;
|
||||||
|
}
|
||||||
| BORDERWIDTH NUMBER {
|
| BORDERWIDTH NUMBER {
|
||||||
if ($2 < 0 || $2 > INT_MAX) {
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
yyerror("invalid borderwidth");
|
yyerror("invalid borderwidth");
|
||||||
@@ -357,6 +367,8 @@ lookup(char *s)
|
|||||||
{ "menufg", MENUFG},
|
{ "menufg", MENUFG},
|
||||||
{ "moveamount", MOVEAMOUNT},
|
{ "moveamount", MOVEAMOUNT},
|
||||||
{ "no", NO},
|
{ "no", NO},
|
||||||
|
{ "raise-delay", RAISEONHOVERDELAY},
|
||||||
|
{ "raise-on-hover", RAISEONHOVER},
|
||||||
{ "scalefactor", SCALEFACTOR},
|
{ "scalefactor", SCALEFACTOR},
|
||||||
{ "selfont", FONTSELCOLOR},
|
{ "selfont", FONTSELCOLOR},
|
||||||
{ "snapdist", SNAPDIST},
|
{ "snapdist", SNAPDIST},
|
||||||
|
|||||||
35
xevents.c
35
xevents.c
@@ -30,6 +30,7 @@
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.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
|
static void
|
||||||
xev_handle_enternotify(XEvent *ee)
|
xev_handle_enternotify(XEvent *ee)
|
||||||
{
|
{
|
||||||
@@ -231,6 +257,15 @@ xev_handle_enternotify(XEvent *ee)
|
|||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL)
|
if ((cc = client_find(e->window)) != NULL)
|
||||||
client_set_active(cc);
|
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
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user