add globals for connection/screen

This commit is contained in:
Dylan Araps 2020-07-21 10:02:14 +03:00
parent d1535393aa
commit 136c30403b
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
5 changed files with 16 additions and 11 deletions

View File

@ -9,7 +9,7 @@ ALL_LDFLAGS = $(LDFLAGS) $(LIBS) -lxcb
CC = cc CC = cc
OBJ = src/event.o src/sowm.o OBJ = src/event.o src/sowm.o
HDR = src/event.h HDR = src/event.h src/globals.h
.c.o: .c.o:
$(CC) $(ALL_CFLAGS) -c -o $@ $< $(CC) $(ALL_CFLAGS) -c -o $@ $<

View File

@ -1,3 +1,4 @@
#include "globals.h"
#include "event.h" #include "event.h"
void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *) = { 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 [XCB_MOTION_NOTIFY] = event_notify_motion
}; };
/* todo */
void event_button_press(xcb_generic_event_t *ev) { } 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_configure_request(xcb_generic_event_t *ev) { }
void event_key_press(xcb_generic_event_t *ev) { } void event_key_press(xcb_generic_event_t *ev) { }
void event_notify_create(xcb_generic_event_t *ev) { } void event_notify_create(xcb_generic_event_t *ev) { }

View File

@ -1,6 +1,3 @@
#ifndef SOWM_EVENT_H_INCLUDED
#define SOWM_EVENT_H_INCLUDED
#include <xcb/xcb.h> #include <xcb/xcb.h>
void event_button_press(xcb_generic_event_t *ev); 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); void event_notify_motion(xcb_generic_event_t *ev);
extern void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *); extern void (*events[XCB_NO_OPERATION])(xcb_generic_event_t *);
#endif

4
src/globals.h Normal file
View File

@ -0,0 +1,4 @@
#include <xcb/xcb.h>
extern xcb_connection_t *dpy;
extern xcb_screen_t *scr;

View File

@ -5,13 +5,14 @@
#include <xcb/xcb.h> #include <xcb/xcb.h>
#include "event.h" #include "event.h"
#include "globals.h"
static xcb_connection_t *dpy;
static xcb_screen_t *scr;
static void init_wm(void); static void init_wm(void);
static void init_input(void); static void init_input(void);
xcb_connection_t *dpy;
xcb_screen_t *scr;
static void init_wm(void) { static void init_wm(void) {
uint32_t values[2]; uint32_t values[2];