Japanese translation of message catalog for Sawfish Window-Manager
Revision | 071c443cc19b222ebc95dd91ff3ffcc247a57cdf (tree) |
---|---|
Time | 2010-04-27 23:50:31 |
Author | Christopher Roy Bratusek <zanghar@free...> |
Commiter | Christopher Roy Bratusek |
added randr-changed-notify-hook & stub
@@ -8,6 +8,12 @@ | ||
8 | 8 | line is not [Desktop Entry]. |
9 | 9 | -- [Matthew Love/Teika Kazura] |
10 | 10 | |
11 | + * src/Makefile.in | |
12 | + * src/display.c | |
13 | + * src/events.c: add a way to response to XRandR changed events | |
14 | + eg resolution changes via randr-change-notify-hook | |
15 | + -- [Daniel M. German] | |
16 | + | |
11 | 17 | 2010-04-06 Teika Kazura <teika@lavabit.com> |
12 | 18 | * lisp/sawfish/wm/autoload.jl |
13 | 19 | * lisp/sawfish/wm/commands.jl |
@@ -36,6 +36,9 @@ the file, if the first valid line is not [Desktop Entry]. | ||
36 | 36 | @item New Features |
37 | 37 | @itemize @minus |
38 | 38 | |
39 | +@item Added a way to response to XRandR changed events (eg resolution changes) | |
40 | +via @code{randr-changed-notify-hook} [Daniel M. German] | |
41 | + | |
39 | 42 | @item Tabbed windowing system improvements [Fuchur] |
40 | 43 | @itemize + |
41 | 44 | @item Support for transient tab-frames |
@@ -39,14 +39,14 @@ DL_DIRS = sawfish/wm/util | ||
39 | 39 | |
40 | 40 | INSTALL_HDRS = sawfish.h sawfish_subrs.h libclient.h server.h keys.h build.h |
41 | 41 | |
42 | -override CFLAGS := $(CFLAGS) $(REP_CFLAGS) $(IMAGE_CFLAGS) $(X11_CFLAGS) $(PANGO_CFLAGS) | |
42 | +override CFLAGS := $(CFLAGS) $(REP_CFLAGS) $(IMAGE_CFLAGS) $(X11_CFLAGS) $(PANGO_CFLAGS) | |
43 | 43 | |
44 | 44 | all : sawfish libclient.o $(DL_OBJS) .libexec gtk-style |
45 | 45 | |
46 | 46 | sawfish : $(OBJS) $(LIBOBJS) |
47 | 47 | $(rep_LIBTOOL) --mode=link --tag=CC $(CC) -export-dynamic $(LDFLAGS) \ |
48 | 48 | -o sawfish $(OBJS) $(LIBOBJS) $(REP_LIBS) $(PANGO_LIBS) \ |
49 | - $(IMAGE_LIBS) $(X11_LIBS) $(EXTRA_X11_LIBS) $(LIBS) | |
49 | + $(IMAGE_LIBS) $(X11_LIBS) $(EXTRA_X11_LIBS) $(LIBS) $(XRANDR_LIBS) | |
50 | 50 | |
51 | 51 | %.la : %.lo |
52 | 52 | $(rep_DL_LD) $(LDFLAGS) -o $@ $< |
@@ -55,10 +55,10 @@ libclient_.lo : libclient.c | ||
55 | 55 | $(rep_LIBTOOL) --mode=compile --tag=CC $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< |
56 | 56 | |
57 | 57 | client.la : client.lo libclient_.lo |
58 | - $(rep_DL_LD) $(LDFLAGS) -o $@ $^ $(X11_LIBS) $(REP_LIBS) $(LIBS) | |
58 | + $(rep_DL_LD) $(LDFLAGS) -o $@ $^ $(X11_LIBS) $(REP_LIBS) $(LIBS) $(XRANDR_LIBS) | |
59 | 59 | |
60 | 60 | gtk-style : gtk-style.c |
61 | - $(CC) $(CFLAGS) $(CPPFLAGS) $(GTK_CFLAGS) $(LDFLAGS) -o $@ $< $(GTK_LIBS) $(LIBS) | |
61 | + $(CC) $(CFLAGS) $(CPPFLAGS) $(GTK_CFLAGS) $(LDFLAGS) -o $@ $< $(GTK_LIBS) $(LIBS) $(XRANDR_LIBS) | |
62 | 62 | |
63 | 63 | install : all installdirs |
64 | 64 | for p in sawfish; do \ |
@@ -45,7 +45,7 @@ | ||
45 | 45 | #endif |
46 | 46 | |
47 | 47 | char *visual_name; |
48 | -Display *dpy; | |
48 | +Display *dpy = NULL; | |
49 | 49 | int screen_num, screen_width, screen_height; |
50 | 50 | Window root_window, no_focus_window; |
51 | 51 | int shape_event_base, shape_error_base; |
@@ -31,6 +31,7 @@ | ||
31 | 31 | #include <X11/Xresource.h> |
32 | 32 | #include <X11/Xatom.h> |
33 | 33 | #include <glib.h> |
34 | +#include <stdio.h> | |
34 | 35 | |
35 | 36 | /* Lookup table of event handlers */ |
36 | 37 | void (*event_handlers[LASTEvent])(XEvent *ev); |
@@ -69,6 +70,13 @@ static XID event_handler_context; | ||
69 | 70 | |
70 | 71 | static Atom xa_sawfish_timestamp; |
71 | 72 | |
73 | +/* is there xrand support? */ | |
74 | +static int has_randr = FALSE; | |
75 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
76 | +static int randr_event_base; /* Will give us the offset for the xrandr events */ | |
77 | +#endif | |
78 | + | |
79 | + | |
72 | 80 | DEFSYM(visibility_notify_hook, "visibility-notify-hook"); |
73 | 81 | DEFSYM(destroy_notify_hook, "destroy-notify-hook"); |
74 | 82 | DEFSYM(map_notify_hook, "map-notify-hook"); |
@@ -89,6 +97,11 @@ DEFSYM(enter_frame_part_hook, "enter-frame-part-hook"); | ||
89 | 97 | DEFSYM(leave_frame_part_hook, "leave-frame-part-hook"); |
90 | 98 | DEFSYM(configure_request_hook, "configure-request-hook"); |
91 | 99 | DEFSYM(configure_notify_hook, "configure-notify-hook"); |
100 | + | |
101 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
102 | +DEFSYM(randr_change_notify_hook, "randr-change-notify-hook"); | |
103 | +#endif | |
104 | + | |
92 | 105 | DEFSYM(window_state_change_hook, "window-state-change-hook"); |
93 | 106 | |
94 | 107 | DEFSYM(pointer_motion_threshold, "pointer-motion-threshold"); |
@@ -1265,6 +1278,20 @@ shape_notify (XEvent *ev) | ||
1265 | 1278 | } |
1266 | 1279 | } |
1267 | 1280 | |
1281 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
1282 | +static void | |
1283 | +randr_screen_change_notify (XEvent *ev) | |
1284 | +{ | |
1285 | + // Only do it if we are sure we are handling the event | |
1286 | + if (has_randr) { | |
1287 | + fprintf(stderr, "Yes, we are handling the screen change event\n"); | |
1288 | + // We should add the call to the hook | |
1289 | + XRRUpdateConfiguration( ev ); | |
1290 | + // Call the hook | |
1291 | + Fcall_hook(Qrandr_change_notify_hook, Qnil, Qnil); | |
1292 | + } | |
1293 | +} | |
1294 | +#endif | |
1268 | 1295 | |
1269 | 1296 | static int synthetic_configure_mutex; |
1270 | 1297 |
@@ -1407,7 +1434,11 @@ inner_handle_input (repv arg) | ||
1407 | 1434 | event_handlers[ev->type] (ev); |
1408 | 1435 | else if (ev->type == shape_event_base + ShapeNotify) |
1409 | 1436 | shape_notify (ev); |
1410 | - else | |
1437 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
1438 | + else if (ev->type == randr_event_base + RRScreenChangeNotify) | |
1439 | + randr_screen_change_notify(ev); | |
1440 | +#endif | |
1441 | + else | |
1411 | 1442 | fprintf (stderr, "warning: unhandled event: %d\n", ev->type); |
1412 | 1443 | return Qnil; |
1413 | 1444 | } |
@@ -1676,7 +1707,27 @@ void | ||
1676 | 1707 | events_init (void) |
1677 | 1708 | { |
1678 | 1709 | repv tem; |
1710 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
1711 | + int dummy; | |
1712 | +#endif | |
1679 | 1713 | |
1714 | + has_randr = FALSE; | |
1715 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
1716 | + // This code is executed even in batch mode, in | |
1717 | + // which case dpy is not set | |
1718 | + if (dpy != NULL) { | |
1719 | + has_randr = XRRQueryExtension( dpy, &randr_event_base, &dummy ); | |
1720 | + if( has_randr ) | |
1721 | + { | |
1722 | + int major, minor; | |
1723 | + XRRQueryVersion( dpy, &major, &minor ); | |
1724 | + has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) ); | |
1725 | + fprintf(stderr, "it Has randr %d\n", has_randr); | |
1726 | + XRRSelectInput( dpy, root_window, RRScreenChangeNotifyMask ); | |
1727 | + } | |
1728 | + } | |
1729 | + | |
1730 | +#endif | |
1680 | 1731 | event_handlers[VisibilityNotify] = visibility_notify; |
1681 | 1732 | event_handlers[ColormapNotify] = colormap_notify; |
1682 | 1733 | event_handlers[KeyPress] = key_press; |
@@ -1703,6 +1754,16 @@ events_init (void) | ||
1703 | 1754 | event_handlers[CirculateNotify] = circulate_notify; |
1704 | 1755 | event_handlers[MappingNotify] = mapping_notify; |
1705 | 1756 | |
1757 | +#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
1758 | + if (has_randr) | |
1759 | + { | |
1760 | + fprintf(stderr, "Setting handler at event %d\n", randr_event_base + RRScreenChangeNotify); | |
1761 | + // we can't handle the event in the usual manner because the sizes of the | |
1762 | + // arrays event_handler and event_names are defined at compile time. | |
1763 | + rep_INTERN_SPECIAL(randr_change_notify_hook); | |
1764 | + } | |
1765 | +#endif | |
1766 | + | |
1706 | 1767 | event_names[KeyPress] = "KeyPress"; |
1707 | 1768 | event_names[KeyRelease] = "KeyRelease"; |
1708 | 1769 | event_names[ButtonPress] = "ButtonPress"; |