*The Cheat makes some The Cheat noises*
This commit is contained in:
parent
853ba89db0
commit
1dc9a1c90d
2 changed files with 29 additions and 0 deletions
|
@ -20,10 +20,16 @@ hexagram_window *hexagram_window_new_x11(const char *display,
|
|||
|
||||
void hexagram_window_destroy(hexagram_window *window);
|
||||
|
||||
Display *hexagram_window_get_display(hexagram_window *window);
|
||||
|
||||
int hexagram_window_get_display_fd(hexagram_window *window);
|
||||
|
||||
int hexagram_window_show(hexagram_window *window);
|
||||
|
||||
int hexagram_window_repaint_bg(hexagram_window *window);
|
||||
|
||||
int hexagram_window_swap_buffer(hexagram_window *window);
|
||||
|
||||
cairo_t *hexagram_window_create_bg_context(hexagram_window *window);
|
||||
|
||||
cairo_t *hexagram_window_create_fg_context(hexagram_window *window);
|
||||
|
|
23
src/window.c
23
src/window.c
|
@ -1,3 +1,4 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -165,6 +166,14 @@ void hexagram_window_destroy(hexagram_window *window) {
|
|||
(void)XDestroyWindow(window->display, window->win);
|
||||
}
|
||||
|
||||
Display *hexagram_window_get_display(hexagram_window *window) {
|
||||
return window->display;
|
||||
}
|
||||
|
||||
int hexagram_window_get_display_fd(hexagram_window *window) {
|
||||
return ConnectionNumber(window->display);
|
||||
}
|
||||
|
||||
int hexagram_window_show(hexagram_window *window) {
|
||||
if (XSelectInput(window->display, window->win,
|
||||
ExposureMask | ButtonPressMask | KeyPressMask) == 0) {
|
||||
|
@ -181,6 +190,20 @@ error_x:
|
|||
return -1;
|
||||
}
|
||||
|
||||
int hexagram_window_repaint_bg(hexagram_window *window) {
|
||||
return XCopyArea(window->display,
|
||||
window->bg,
|
||||
window->buf,
|
||||
window->gc,
|
||||
0, 0,
|
||||
window->width, window->height,
|
||||
0, 0) == 0? -1: 1;
|
||||
}
|
||||
|
||||
int hexagram_window_swap_buffer(hexagram_window *window) {
|
||||
return XdbeSwapBuffers(window->display, &window->swapinfo, 1) == 0? -1: 1;
|
||||
}
|
||||
|
||||
cairo_t *hexagram_window_create_bg_context(hexagram_window *window) {
|
||||
return cairo_create(window->surface_bg);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue