add support for XRandR
This commit is contained in:
parent
c8abcf33fb
commit
b509d5cbcf
|
@ -30,6 +30,7 @@
|
|||
#include <X11/Xproto.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
|
||||
#include "awesome.h"
|
||||
#include "event.h"
|
||||
|
@ -277,7 +278,7 @@ main(int argc, char *argv[])
|
|||
Display * dpy;
|
||||
Window root;
|
||||
awesome_config awesomeconf;
|
||||
int shape_event;
|
||||
int shape_event, randr_event_base;
|
||||
|
||||
if(argc == 2 && !strcmp("-v", argv[1]))
|
||||
eprint("awesome-" VERSION " © 2007 Julien Danjou\n");
|
||||
|
@ -324,6 +325,10 @@ main(int argc, char *argv[])
|
|||
if((awesomeconf.have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
handler[shape_event] = handle_event_shape;
|
||||
|
||||
/* check for randr extension */
|
||||
if((awesomeconf.have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
||||
|
||||
scan(dpy, &dc, &awesomeconf);
|
||||
XSync(dpy, False);
|
||||
|
||||
|
|
2
config.h
2
config.h
|
@ -141,6 +141,8 @@ struct awesome_config
|
|||
Statusbar statusbar;
|
||||
/** Check for XShape extension */
|
||||
Bool have_shape;
|
||||
/** Check for XRandR extension */
|
||||
Bool have_randr;
|
||||
};
|
||||
|
||||
void parse_config(Display *, int, DC *, awesome_config *); /* parse configuration file */
|
||||
|
|
|
@ -15,7 +15,7 @@ X11LIB = /usr/lib/X11
|
|||
|
||||
# includes and libs
|
||||
INCS = -I. -I/usr/include -I${X11INC} `pkg-config --cflags libconfig`
|
||||
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 `pkg-config --libs libconfig` -lXext
|
||||
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 `pkg-config --libs libconfig` -lXext -lXrandr
|
||||
|
||||
# flags
|
||||
CFLAGS = -fgnu89-inline -std=gnu99 -ggdb3 -pipe -Wall -Wextra -W -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wsign-compare -Wunused -Wuninitialized -Winit-self -Wpointer-arith -Wredundant-decls -Wno-format-zero-length -Wmissing-prototypes -Wmissing-format-attribute -Wmissing-noreturn -O2 ${INCS} -DVERSION=\"${VERSION}\"
|
||||
|
|
8
event.c
8
event.c
|
@ -23,6 +23,7 @@
|
|||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
|
||||
#include "awesome.h"
|
||||
#include "event.h"
|
||||
|
@ -401,6 +402,13 @@ handle_event_shape(XEvent * e,
|
|||
set_shape(c);
|
||||
}
|
||||
|
||||
void
|
||||
handle_event_randr_screen_change_notify(XEvent *e,
|
||||
awesome_config *awesomeconf __attribute__ ((unused)))
|
||||
{
|
||||
XRRUpdateConfiguration(e);
|
||||
}
|
||||
|
||||
void
|
||||
grabkeys(Display *disp, awesome_config *awesomeconf)
|
||||
{
|
||||
|
|
1
event.h
1
event.h
|
@ -39,5 +39,6 @@ void handle_event_maprequest(XEvent *, awesome_config *);
|
|||
void handle_event_propertynotify(XEvent *, awesome_config *);
|
||||
void handle_event_unmapnotify(XEvent *, awesome_config *);
|
||||
void handle_event_shape(XEvent *, awesome_config *);
|
||||
void handle_event_randr_screen_change_notify(XEvent *, awesome_config *);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue