• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Japanese translation of message catalog for Sawfish Window-Manager


Commit MetaInfo

Revision071c443cc19b222ebc95dd91ff3ffcc247a57cdf (tree)
Time2010-04-27 23:50:31
AuthorChristopher Roy Bratusek <zanghar@free...>
CommiterChristopher Roy Bratusek

Log Message

added randr-changed-notify-hook & stub

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,12 @@
88 line is not [Desktop Entry].
99 -- [Matthew Love/Teika Kazura]
1010
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+
1117 2010-04-06 Teika Kazura <teika@lavabit.com>
1218 * lisp/sawfish/wm/autoload.jl
1319 * lisp/sawfish/wm/commands.jl
--- a/man/news.texi
+++ b/man/news.texi
@@ -36,6 +36,9 @@ the file, if the first valid line is not [Desktop Entry].
3636 @item New Features
3737 @itemize @minus
3838
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+
3942 @item Tabbed windowing system improvements [Fuchur]
4043 @itemize +
4144 @item Support for transient tab-frames
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -39,14 +39,14 @@ DL_DIRS = sawfish/wm/util
3939
4040 INSTALL_HDRS = sawfish.h sawfish_subrs.h libclient.h server.h keys.h build.h
4141
42-override CFLAGS := $(CFLAGS) $(REP_CFLAGS) $(IMAGE_CFLAGS) $(X11_CFLAGS) $(PANGO_CFLAGS)
42+override CFLAGS := $(CFLAGS) $(REP_CFLAGS) $(IMAGE_CFLAGS) $(X11_CFLAGS) $(PANGO_CFLAGS)
4343
4444 all : sawfish libclient.o $(DL_OBJS) .libexec gtk-style
4545
4646 sawfish : $(OBJS) $(LIBOBJS)
4747 $(rep_LIBTOOL) --mode=link --tag=CC $(CC) -export-dynamic $(LDFLAGS) \
4848 -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)
5050
5151 %.la : %.lo
5252 $(rep_DL_LD) $(LDFLAGS) -o $@ $<
@@ -55,10 +55,10 @@ libclient_.lo : libclient.c
5555 $(rep_LIBTOOL) --mode=compile --tag=CC $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
5656
5757 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)
5959
6060 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)
6262
6363 install : all installdirs
6464 for p in sawfish; do \
--- a/src/display.c
+++ b/src/display.c
@@ -45,7 +45,7 @@
4545 #endif
4646
4747 char *visual_name;
48-Display *dpy;
48+Display *dpy = NULL;
4949 int screen_num, screen_width, screen_height;
5050 Window root_window, no_focus_window;
5151 int shape_event_base, shape_error_base;
--- a/src/events.c
+++ b/src/events.c
@@ -31,6 +31,7 @@
3131 #include <X11/Xresource.h>
3232 #include <X11/Xatom.h>
3333 #include <glib.h>
34+#include <stdio.h>
3435
3536 /* Lookup table of event handlers */
3637 void (*event_handlers[LASTEvent])(XEvent *ev);
@@ -69,6 +70,13 @@ static XID event_handler_context;
6970
7071 static Atom xa_sawfish_timestamp;
7172
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+
7280 DEFSYM(visibility_notify_hook, "visibility-notify-hook");
7381 DEFSYM(destroy_notify_hook, "destroy-notify-hook");
7482 DEFSYM(map_notify_hook, "map-notify-hook");
@@ -89,6 +97,11 @@ DEFSYM(enter_frame_part_hook, "enter-frame-part-hook");
8997 DEFSYM(leave_frame_part_hook, "leave-frame-part-hook");
9098 DEFSYM(configure_request_hook, "configure-request-hook");
9199 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+
92105 DEFSYM(window_state_change_hook, "window-state-change-hook");
93106
94107 DEFSYM(pointer_motion_threshold, "pointer-motion-threshold");
@@ -1265,6 +1278,20 @@ shape_notify (XEvent *ev)
12651278 }
12661279 }
12671280
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
12681295
12691296 static int synthetic_configure_mutex;
12701297
@@ -1407,7 +1434,11 @@ inner_handle_input (repv arg)
14071434 event_handlers[ev->type] (ev);
14081435 else if (ev->type == shape_event_base + ShapeNotify)
14091436 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
14111442 fprintf (stderr, "warning: unhandled event: %d\n", ev->type);
14121443 return Qnil;
14131444 }
@@ -1676,7 +1707,27 @@ void
16761707 events_init (void)
16771708 {
16781709 repv tem;
1710+#ifdef HAVE_X11_EXTENSIONS_XRANDR_H
1711+ int dummy;
1712+#endif
16791713
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
16801731 event_handlers[VisibilityNotify] = visibility_notify;
16811732 event_handlers[ColormapNotify] = colormap_notify;
16821733 event_handlers[KeyPress] = key_press;
@@ -1703,6 +1754,16 @@ events_init (void)
17031754 event_handlers[CirculateNotify] = circulate_notify;
17041755 event_handlers[MappingNotify] = mapping_notify;
17051756
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+
17061767 event_names[KeyPress] = "KeyPress";
17071768 event_names[KeyRelease] = "KeyRelease";
17081769 event_names[ButtonPress] = "ButtonPress";