aboutsummaryrefslogtreecommitdiffstats
path: root/window-xlib.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-04-15 21:59:47 -0400
committerJesse Luehrs <doy@tozt.net>2014-04-15 21:59:47 -0400
commit204c24cafdc8ae5c1d1085b08c43ef5990a36fa7 (patch)
tree2d57ca5831dd0851f8bebfe87422e9960fda38e2 /window-xlib.c
parentc37389c545b346bf41266859627484a4de742305 (diff)
downloadrunes-204c24cafdc8ae5c1d1085b08c43ef5990a36fa7.tar.gz
runes-204c24cafdc8ae5c1d1085b08c43ef5990a36fa7.zip
more cleanups
Diffstat (limited to 'window-xlib.c')
-rw-r--r--window-xlib.c48
1 files changed, 20 insertions, 28 deletions
diff --git a/window-xlib.c b/window-xlib.c
index fe839ad..2a467f6 100644
--- a/window-xlib.c
+++ b/window-xlib.c
@@ -60,7 +60,6 @@ static struct function_key keys[] = {
};
#undef RUNES_KEY
-static cairo_surface_t *runes_window_backend_surface_create(RunesTerm *t);
static void runes_window_backend_get_next_event(uv_work_t *req);
static void runes_window_backend_process_event(uv_work_t *req, int status);
static void runes_window_backend_map_window(RunesTerm *t);
@@ -79,6 +78,7 @@ void runes_window_backend_create_window(RunesTerm *t, int argc, char *argv[])
XIM im;
Cursor cursor;
XColor cursor_fg, cursor_bg;
+ Visual *vis;
wm_hints.flags = InputHint | StateHint;
wm_hints.input = True;
@@ -137,7 +137,11 @@ void runes_window_backend_create_window(RunesTerm *t, int argc, char *argv[])
XRecolorCursor(w->dpy, cursor, &cursor_fg, &cursor_bg);
XDefineCursor(w->dpy, w->w, cursor);
- t->backend_cr = cairo_create(runes_window_backend_surface_create(t));
+ vis = DefaultVisual(w->dpy, DefaultScreen(w->dpy));
+ t->backend_cr = cairo_create(
+ cairo_xlib_surface_create(
+ w->dpy, w->w, vis,
+ normal_hints.base_width, normal_hints.base_height));
runes_window_backend_map_window(t);
}
@@ -179,6 +183,20 @@ void runes_window_backend_request_flush(RunesTerm *t)
XUnlockDisplay(t->w.dpy);
}
+void runes_window_backend_request_close(RunesTerm *t)
+{
+ XEvent e;
+
+ e.xclient.type = ClientMessage;
+ e.xclient.window = t->w.w;
+ e.xclient.message_type = t->w.atoms[RUNES_ATOM_WM_PROTOCOLS];
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = t->w.atoms[RUNES_ATOM_WM_DELETE_WINDOW];
+ e.xclient.data.l[1] = CurrentTime;
+
+ XSendEvent(t->w.dpy, t->w.w, False, NoEventMask, &e);
+}
+
void runes_window_backend_get_size(RunesTerm *t, int *xpixel, int *ypixel)
{
cairo_surface_t *surface;
@@ -227,20 +245,6 @@ void runes_window_backend_visual_bell(RunesTerm *t)
runes_window_backend_flush(t);
}
-void runes_window_backend_request_close(RunesTerm *t)
-{
- XEvent e;
-
- e.xclient.type = ClientMessage;
- e.xclient.window = t->w.w;
- e.xclient.message_type = t->w.atoms[RUNES_ATOM_WM_PROTOCOLS];
- e.xclient.format = 32;
- e.xclient.data.l[0] = t->w.atoms[RUNES_ATOM_WM_DELETE_WINDOW];
- e.xclient.data.l[1] = CurrentTime;
-
- XSendEvent(t->w.dpy, t->w.w, False, NoEventMask, &e);
-}
-
void runes_window_backend_cleanup(RunesTerm *t)
{
RunesWindowBackend *w = &t->w;
@@ -253,18 +257,6 @@ void runes_window_backend_cleanup(RunesTerm *t)
XCloseDisplay(w->dpy);
}
-static cairo_surface_t *runes_window_backend_surface_create(RunesTerm *t)
-{
- RunesWindowBackend *w = &t->w;
- Visual *vis;
- XWindowAttributes attrs;
-
- XGetWindowAttributes(w->dpy, w->w, &attrs);
- vis = DefaultVisual(w->dpy, DefaultScreen(w->dpy));
- return cairo_xlib_surface_create(
- w->dpy, w->w, vis, attrs.width, attrs.height);
-}
-
static void runes_window_backend_get_next_event(uv_work_t *req)
{
RunesXlibLoopData *data;