summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c
index 1f5df1b..d5b7d8a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -37,7 +37,7 @@ XCreateWindow(Display *xdisplay, Window xparent, int x, int y,
unsigned long valuemask,
XSetWindowAttributes *attributes)
{
- struct csx_display *display = xdisplay->csx_display;
+ struct csx_display *display = csx_display(xdisplay);
struct csx_window *window, *parent;
int i;
@@ -73,7 +73,10 @@ XCreateWindow(Display *xdisplay, Window xparent, int x, int y,
case CWBackingPixel:
case CWOverrideRedirect:
case CWSaveUnder:
+ break;
case CWEventMask:
+ window->event_mask = attributes->event_mask;
+ break;
case CWDontPropagate:
case CWColormap:
case CWCursor:
@@ -84,10 +87,43 @@ XCreateWindow(Display *xdisplay, Window xparent, int x, int y,
return window->id;
}
+WL_EXPORT Window
+XCreateSimpleWindow(Display *xdisplay, Window parent, int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned int border_width, unsigned long border,
+ unsigned long background)
+{
+ unsigned long valuemask;
+ XSetWindowAttributes attributes;
+
+ attributes.background_pixel = background;
+ attributes.border_pixel = border;
+ return XCreateWindow(xdisplay, parent, x, y, width, height,
+ border_width, 0, CopyFromParent, CopyFromParent,
+ CWBackPixel | CWBorderPixel, &attributes);
+}
+
void
csx_display_send_map_notify(struct csx_display *display,
struct csx_window *window)
{
+ struct csx_event *event;
+
+ if (!(window->event_mask & StructureNotifyMask))
+ return;
+
+ event = malloc(sizeof *event);
+ event->xevent.type = MapNotify;
+
+ event->xevent.xmap.type = MapNotify;
+ event->xevent.xmap.serial = display->serial;
+ event->xevent.xmap.send_event = False;
+ event->xevent.xmap.display = display->xdisplay;
+ event->xevent.xmap.event = window->id;
+ event->xevent.xmap.window = window->id;
+ event->xevent.xmap.override_redirect = False;
+
+ wl_list_insert(display->event_list.prev, &event->link);
}
void
@@ -99,6 +135,7 @@ csx_window_map_tree(struct csx_window *window, struct csx_pixmap *pixmap)
csx_window_map_tree(child, pixmap);
window->pixmap = pixmap;
+ csx_display_send_map_notify(window->display, window);
}
void
@@ -122,7 +159,7 @@ csx_window_map_toplevel(struct csx_window *window)
WL_EXPORT int
XMapWindow(Display *xdisplay, Window xwindow)
{
- struct csx_display *display = xdisplay->csx_display;
+ struct csx_display *display = csx_display(xdisplay);
struct csx_window *window;
struct csx_pixmap *pixmap;
@@ -168,7 +205,7 @@ csx_window_destroy(struct csx_window *window)
WL_EXPORT int
XDestroyWindow(Display *xdisplay, Window xwindow)
{
- struct csx_display *display = xdisplay->csx_display;
+ struct csx_display *display = csx_display(xdisplay);
struct csx_window *window;
window = csx_display_lookup_resource(display, xwindow);
@@ -185,7 +222,7 @@ XDestroyWindow(Display *xdisplay, Window xwindow)
WL_EXPORT int
XDestroySubwindows(Display *xdisplay, Window xwindow)
{
- struct csx_display *display = xdisplay->csx_display;
+ struct csx_display *display = csx_display(xdisplay);
struct csx_window *window, *child, *next;
window = csx_display_lookup_resource(display, xwindow);