274
271
attrs = rep_CDR (attrs);
276
273
w->height = changes->height;
279
+static x_str_value x_event_mask_matches[] = {
280
+ { "key-press", KeyPressMask },
281
+ { "key-release", KeyReleaseMask },
282
+ { "button-press", ButtonPressMask },
283
+ { "button-release", ButtonReleaseMask },
284
+ { "enter-window", EnterWindowMask },
285
+ { "leave-window", LeaveWindowMask },
286
+ { "pointer-motion", PointerMotionMask },
287
+ { "pointer-motion-hint", PointerMotionHintMask },
288
+ { "button-1-motion", Button1MotionMask },
289
+ { "button-2-motion", Button2MotionMask },
290
+ { "button-3-motion", Button3MotionMask },
291
+ { "button-4-motion", Button4MotionMask },
292
+ { "button-5-motion", Button5MotionMask },
293
+ { "button-motion", ButtonMotionMask },
294
+ { "keymap-state", KeymapStateMask },
295
+ { "exposure", ExposureMask },
296
+ { "visibility-change", VisibilityChangeMask },
297
+ { "structure-notify", StructureNotifyMask },
298
+ { "resize-redirect", ResizeRedirectMask },
299
+ { "substructure-notify", SubstructureNotifyMask },
300
+ { "substructure-redirect", SubstructureRedirectMask },
301
+ { "focus-change", FocusChangeMask },
302
+ { "property-change", PropertyChangeMask },
303
+ { "colormap-change", ColormapChangeMask },
304
+ { "owner-grab-button", OwnerGrabButtonMask },
276
+static x_value_str x_event_mask_matches[] = {
277
+ { KeyPressMask, "key-press" },
278
+ { KeyReleaseMask, "key-release" },
279
+ { ButtonPressMask, "button-press" },
280
+ { ButtonReleaseMask, "button-release" },
281
+ { EnterWindowMask, "enter-window" },
282
+ { LeaveWindowMask, "leave-window" },
283
+ { PointerMotionMask, "pointer-motion" },
284
+ { PointerMotionHintMask, "pointer-motion-hint" },
285
+ { Button1MotionMask, "button-1-motion" },
286
+ { Button2MotionMask, "button-2-motion" },
287
+ { Button3MotionMask, "button-3-motion" },
288
+ { Button4MotionMask, "button-4-motion" },
289
+ { Button5MotionMask, "button-5-motion" },
290
+ { ButtonMotionMask, "button-motion" },
291
+ { KeymapStateMask, "keymap-state" },
292
+ { ExposureMask, "exposure" },
293
+ { VisibilityChangeMask, "visibility-change" },
294
+ { StructureNotifyMask, "structure-notify" },
295
+ { ResizeRedirectMask, "resize-redirect" },
296
+ { SubstructureNotifyMask, "substructure-notify" },
297
+ { SubstructureRedirectMask, "substructure-redirect" },
298
+ { FocusChangeMask, "focus-change" },
299
+ { PropertyChangeMask, "property-change" },
300
+ { ColormapChangeMask, "colormap-change" },
301
+ { OwnerGrabButtonMask, "owner-grab-button" },
309
306
x_window_parse_attributes (XSetWindowAttributes *attributes, repv attrs)
312
309
attributes->border_pixel = VCOLOR (rep_CDR (tem))->pixel;
313
310
attributesMask |= CWBorderPixel;
520
535
+ case DestroyNotify:
521
+ ALIST_PRE (event, Qevent, x_window_from_id (ev->xdestroywindow.event));
522
+ tmp = x_window_from_id (ev->xdestroywindow.window);
524
+ tmp = rep_MAKE_INT (ev->xdestroywindow.window);
525
+ ALIST_PRE (event, Qwindow, tmp);
536
+ ALIST_PRE (event, Qevent, x_window_or_int_from_id (ev->xdestroywindow.event));
537
+ ALIST_PRE (event, Qwindow, x_window_or_int_from_id (ev->xdestroywindow.window));
540
+ case ConfigureNotify:
541
+ ALIST_PRE (event, Qevent, x_window_or_int_from_id (ev->xconfigure.event));
542
+ ALIST_PRE (event, Qwindow, x_window_or_int_from_id (ev->xconfigure.window));
543
+ ALIST_PRE (event, Qx, rep_MAKE_INT (ev->xconfigure.x));
544
+ ALIST_PRE (event, Qy, rep_MAKE_INT (ev->xconfigure.y));
545
+ ALIST_PRE (event, Qwidth, rep_MAKE_INT (ev->xconfigure.width));
546
+ ALIST_PRE (event, Qheight, rep_MAKE_INT (ev->xconfigure.height));
547
+ ALIST_PRE (event, Qborder_width, rep_MAKE_INT (ev->xconfigure.border_width));
548
+ ALIST_PRE (event, Qabove, x_window_or_int_from_id (ev->xconfigure.above));
549
+ ALIST_PRE (event, Qoverride_redirect, ev->xconfigure.override_redirect ? Qt : Qnil);
552
+ case ConfigureRequest:
553
+ ALIST_PRE (event, Qparent, x_window_or_int_from_id (ev->xconfigurerequest.parent));
554
+ ALIST_PRE (event, Qwindow, x_window_or_int_from_id (ev->xconfigurerequest.window));
555
+ ALIST_PRE (event, Qx, rep_MAKE_INT (ev->xconfigurerequest.x));
556
+ ALIST_PRE (event, Qy, rep_MAKE_INT (ev->xconfigurerequest.y));
557
+ ALIST_PRE (event, Qwidth, rep_MAKE_INT (ev->xconfigurerequest.width));
558
+ ALIST_PRE (event, Qheight, rep_MAKE_INT (ev->xconfigurerequest.height));
559
+ ALIST_PRE (event, Qborder_width, rep_MAKE_INT (ev->xconfigurerequest.border_width));
560
+ ALIST_PRE (event, Qabove, x_window_or_int_from_id (ev->xconfigurerequest.above));
561
+ ALIST_PRE (event, Qdetail, x_value_match (ev->xconfigurerequest.detail, x_stack_mode_matches));
562
+ ALIST_PRE (event, Qvalue_mask, x_valuemask_match (ev->xconfigurerequest.value_mask, x_configure_mask_matches));
528
565
+ case ClientMessage:
693
731
BlackPixel (dpy, screen_num));
694
732
attributesMask |= CWBorderPixel;
697
- attributesMask |= CWOverrideRedirect | CWEventMask | CWColormap;
698
734
+ attributes.colormap = image_cmap;
699
735
+ attributesMask |= CWOverrideRedirect;
737
- attributesMask |= CWOverrideRedirect | CWEventMask | CWColormap;
701
739
- id = XCreateWindow (dpy, root_window, _x, _y, _w, _h, _bw,
702
740
+ id = XCreateWindow (dpy, _parent, _x, _y, _w, _h, _bw,
703
741
image_depth, InputOutput, image_visual,
704
742
attributesMask, &attributes);
706
@@ -708,6 +1138,37 @@
744
@@ -738,17 +1206,80 @@
707
745
return rep_VAL (w);
741
779
DEFUN ("x-map-window", Fx_map_window, Sx_map_window,
742
780
(repv win, repv unraised), rep_Subr2) /*
743
781
::doc:sawfish.wm.util.x#x-map-window::
744
@@ -722,6 +1183,38 @@
782
x-map-window X-WINDOW [UNRAISED]
785
- rep_DECLARE1 (win, X_WINDOWP);
786
+ rep_DECLARE1 (win, ANY_WINDOWP);
787
if (unraised == Qnil)
788
- XMapRaised (dpy, VX_DRAWABLE (win)->id);
789
+ XMapRaised (dpy, window_from_arg (win));
791
- XMapWindow (dpy, VX_DRAWABLE (win)->id);
792
+ XMapWindow (dpy, window_from_arg (win));
748
796
+DEFUN ("x-x-map-window", Fx_x_map_window, Sx_x_map_window, (repv win), rep_Subr1) /*
749
797
+::doc:sawfish.wm.util.x#x-x-map-window::
750
798
+x-x-map-window X-WINDOW
772
820
+x-map-subwindows X-WINDOW
775
+ rep_DECLARE1(win, X_WINDOWP);
776
+ XMapSubwindows (dpy, VX_DRAWABLE(win)->id);
823
+ rep_DECLARE1(win, ANY_WINDOWP);
824
+ XMapSubwindows (dpy, window_from_arg (win));
828
@@ -758,8 +1289,52 @@
829
x-unmap-window X-WINDOW
832
- rep_DECLARE1 (win, X_WINDOWP);
833
- XUnmapWindow (dpy, VX_DRAWABLE (win)->id);
834
+ rep_DECLARE1 (win, ANY_WINDOWP);
835
+ XUnmapWindow (dpy, window_from_arg (win));
780
DEFUN ("x-unmap-window", Fx_unmap_window,
781
Sx_unmap_window, (repv win), rep_Subr1) /*
782
::doc:sawfish.wm.util.x#x-unmap-window::
783
@@ -733,6 +1226,50 @@
787
839
+DEFUN("x-unmap-subwindows", Fx_unmap_subwindows, Sx_unmap_subwindows, (repv win), rep_Subr1) /*
788
840
+::doc:sawfish.wm.util.x#x-unmap-subwindows::
789
841
+x-unmap-subwindows X-WINDOW
792
+ rep_DECLARE1(win, X_WINDOWP);
793
+ XUnmapSubwindows (dpy, VX_DRAWABLE(win)->id);
844
+ rep_DECLARE1(win, ANY_WINDOWP);
845
+ XUnmapSubwindows (dpy, window_from_arg (win));
1308
+DEFUN("x-get-window-property", Fx_get_window_property, Sx_get_window_property, (repv args), rep_SubrN) /*
1309
+::doc:sawfish.wm.util.x#x-get-window-property::
1310
+x-get-window-property X-WINDOW PROPERTY LONG-OFFSET LONG-LENGTH DELETE TYPE
1312
+Gets the specified PROPERTY from the specified X-WINDOW. If
1313
+DELETE is non-nil then the property is deleted. The return
1314
+is a list (type format bytes-after [value]).
1317
+ repv window, property, offset, length, delete, type, format, nbytes, data;
1319
+ Atom _property, _type, _ret_type;
1321
+ long _offset, _length;
1323
+ unsigned long _ret_nitems, _ret_nbytes;
1324
+ unsigned char *_ret;
1327
+ /* I'm careless with my ints and longs */
1329
+ nDECLARE (1, window, ANY_WINDOWP (window));
1330
+ _window = window_from_arg (window);
1331
+ nDECLARE (2, property, rep_SYMBOLP (property));
1332
+ _property = x_symbol_atom (property);
1333
+ nDECLARE (3, offset, rep_INTP (offset));
1334
+ _offset = rep_INT (offset);
1335
+ nDECLARE (4, length, rep_INTP (length));
1336
+ _length = rep_INT (length);
1337
+ nDECLARE (5, delete, 1);
1338
+ _delete = delete != Qnil;
1339
+ nDECLARE (6, type, rep_SYMBOLP (type));
1340
+ _type = x_symbol_atom (type);
1342
+ XGetWindowProperty (dpy, _window, _property, _offset, _length, _delete,
1343
+ _type, &_ret_type, &_ret_fmt, &_ret_nitems, &_ret_nbytes, &_ret);
1345
+ type = x_atom_symbol (_ret_type);
1346
+ format = rep_MAKE_INT (_ret_fmt);
1347
+ nbytes = rep_MAKE_INT (_ret_nbytes);
1348
+ n = (int) _ret_nitems;
1349
+ data = Fmake_vector (rep_MAKE_INT (n), Qnil);
1350
+ for (i = 0; i < n; ++ i) {
1351
+ switch (_ret_fmt) {
1353
+ rep_VECTI (data, i) = rep_MAKE_INT (_ret[i]);
1356
+ rep_VECTI (data, i) = rep_MAKE_INT (((unsigned short *) _ret)[i]);
1359
+ rep_VECTI (data, i) = rep_MAKE_INT (((unsigned int *) _ret)[i]);
1364
+ return Fcons (type, Fcons (format, Fcons (nbytes, Fcons (data, Qnil))));
1247
1368
/* Drawing functions */
1249
1370
DEFUN ("x-clear-window", Fx_clear_window,
1250
@@ -1425,6 +2324,7 @@
1371
@@ -1456,6 +2453,7 @@
1251
1372
x_window_mark (repv obj)
1253
1374
rep_MARKVAL (VX_DRAWABLE (obj)->event_handler);