add globals for connection/screen

This commit is contained in:
Dylan Araps
2020-07-21 10:02:14 +03:00
parent d1535393aa
commit 136c30403b
5 changed files with 16 additions and 11 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ ALL_LDFLAGS = $(LDFLAGS) $(LIBS) -lxcb
CC = cc
OBJ = src/event.o src/sowm.o
HDR = src/event.h
HDR = src/event.h src/globals.h
.c.o:
$(CC) $(ALL_CFLAGS) -c -o $@ $<
+7 -2
View File
@@ -1,3 +1,4 @@
#include "globals.h"
#include "event.h"
void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *) = {
@@ -11,9 +12,13 @@ void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *) = {
[XCB_MOTION_NOTIFY] = event_notify_motion
};
/* todo */
void event_button_press(xcb_generic_event_t *ev) { }
void event_button_release(xcb_generic_event_t *ev) { }
void event_button_release(xcb_generic_event_t *ev) {
xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
xcb_flush(dpy);
}
void event_configure_request(xcb_generic_event_t *ev) { }
void event_key_press(xcb_generic_event_t *ev) { }
void event_notify_create(xcb_generic_event_t *ev) { }
-5
View File
@@ -1,6 +1,3 @@
#ifndef SOWM_EVENT_H_INCLUDED
#define SOWM_EVENT_H_INCLUDED
#include <xcb/xcb.h>
void event_button_press(xcb_generic_event_t *ev);
@@ -13,5 +10,3 @@ void event_notify_enter(xcb_generic_event_t *ev);
void event_notify_motion(xcb_generic_event_t *ev);
extern void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *);
#endif
+4
View File
@@ -0,0 +1,4 @@
#include <xcb/xcb.h>
extern xcb_connection_t *dpy;
extern xcb_screen_t *scr;
+4 -3
View File
@@ -5,13 +5,14 @@
#include <xcb/xcb.h>
#include "event.h"
static xcb_connection_t *dpy;
static xcb_screen_t *scr;
#include "globals.h"
static void init_wm(void);
static void init_input(void);
xcb_connection_t *dpy;
xcb_screen_t *scr;
static void init_wm(void) {
uint32_t values[2];