• 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

Revision45018829c8fea41bf75ab7f6ca003deb53e8d796 (tree)
Time2010-05-11 14:14:45
AuthorTeika kazura <teika@lava...>
CommiterTeika kazura

Log Message

Completes recent RandR patch. At least it's correct if you have only one screen, or if you use Xinerama.
Most importantly, XRRUpdateConfiguration is called after XRRScreenChangeNotifyEvent. This ensures update inside of Xlib.

Other changes:
NULL display check of the RandR is changed to Sawfish conventional way. (Just to be in accordance.)
Minor memeory leak fix.
Doc. 'configure-notify-hook' is described, too.

Change Summary

Incremental Difference

--- a/man/news.texi
+++ b/man/news.texi
@@ -36,8 +36,8 @@ 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]
39+@item XRandR events (eg resolution changes) call the new hook
40+@code{randr-changed-notify-hook} [Daniel M. German]
4141
4242 @item Tabbed windowing system improvements [Fuchur]
4343 @itemize +
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -76,7 +76,7 @@ For edit history, see @file{ChangeLog} file.
7676 * Window Frames:: Decorating windows
7777 * Viewports:: Subdivided desktop areas
7878 * Workspaces:: Multiple desktop areas
79-* Multi-Head Environments:: Multiple monitors
79+* RandR and Xinerama:: Many monitors and updates
8080 * Window Placement:: Controlling placement of new windows
8181 * Popup Menus:: Displaying menus
8282 * Events:: Input event types
@@ -4321,7 +4321,7 @@ When true, windows uniconify to the current viewport, rather than to
43214321 the viewport they were iconified on. Defaults to true.
43224322 @end defvr
43234323
4324-@node Workspaces, Multi-Head Environments, Viewports, Top
4324+@node Workspaces, RandR and Xinerama, Viewports, Top
43254325 @chapter Workspaces
43264326 @cindex Workspaces
43274327 @cindex Desktop workspaces
@@ -4741,21 +4741,43 @@ Add edge windows used to implement flipping.
47414741 Remove the edge windows used to implement flipping.
47424742 @end defun
47434743
4744-@node Multi-Head Environments, Window Placement, Workspaces, Top
4745-@chapter Multi-Head Environments
4744+@node RandR and Xinerama, Window Placement, Workspaces, Top
4745+@chapter RandR and Xinerama
4746+@cindex RandR
4747+@cindex Xrandr
4748+@cindex Xinerama
4749+
4750+Sawfish supports multiple monitors displaying a single logical screen.
4751+Partial support of RandR is done.
4752+
4753+@defun has-randr-p
4754+Returns @code{t} if RandR is supported.
4755+@end defun
4756+
4757+@menu
4758+* Multi-head Environment::
4759+* Screen Change Notification::
4760+@end menu
4761+
4762+@node Multi-head Environment, Screen Change Notification,, RandR and Xinerama
4763+@section Multi-head Environment
47464764 @cindex Multi-head environments
47474765 @cindex Environments, multi-head
47484766 @cindex Monitors, multiple
4749-@cindex Xinerama
47504767
4751-Sawfish supports multiple monitors displaying a single logical screen,
4752-as provided by Xinerama.
4768+Functions which provide information on monitor geometries are
4769+available. On the other hand, few user interface functions take them
4770+into account, so for example, windows often appear across multiple
4771+monitors.
4772+
4773+Currently, monitor geometries are taken from Xinerama only. RandR
4774+support in this regard is yet to be done.
47534775
47544776 A ``head'' means each physical monitor. When there're multiple heads,
47554777 the word ``screen'' means the entire screen which is the combination
47564778 of all heads. For example the function @code{screen-width} returns the
47574779 width of the ``screen'' in this sense. A viewport contains the entire
4758-screen. The only exception is that maximization is done within a
4780+screen. The only exception is maximizations which are done within a
47594781 head, unless stated explicitly that it's xinerama.
47604782
47614783 @defun find-head x y
@@ -4813,8 +4835,29 @@ containing the window @var{window}, or the pointer if @var{window} is
48134835 false). Returns @code{'(0 . 0)} if no such head can be identified.
48144836 @end defun
48154837
4838+@node Screen Change Notification, , Multi-head Environment, RandR and Xinerama
4839+@section Screen Change Notification
4840+@cindex Screen change notification
4841+@cindex Change, of screen
4842+
4843+If some changes happen to the screen, hot-plugging, removal, or
4844+resolution change, then you can receive the notification.
4845+
4846+One way is to use @code{configure-notify-hook}.(@pxref{X Hooks})
4847+Then the window argument is set to the symbol @code{root}. The other way
4848+is to use @code{randr-change-notify-hook} below. Both are called,
4849+but there's no guarantee of the order.
48164850
4817-@node Window Placement, Popup Menus, Multi-Head Environments, Top
4851+Notice that both may be called several times for one change. For
4852+example, ``xrandr'' command invocation from shell triggers three
4853+calls of both hooks in an author's environment.
4854+
4855+@defvr {Hook} randr-change-notify-hook
4856+Called when screen configuration changes, via RandR extension support.
4857+When RandR is not supported, then this hook will never be called.
4858+@end defvr
4859+
4860+@node Window Placement, Popup Menus, RandR and Xinerama, Top
48184861 @chapter Window Placement
48194862 @cindex Placement of windows
48204863
@@ -6859,6 +6902,11 @@ of configure request properties. This alist may contain items
68596902 and @code{(dimensions . @var{dimensions})}.
68606903 @end defvr
68616904
6905+@defvr {Window Hook} configure-notify-hook
6906+Called when an X @code{ConfigureNotify} event is received, i.e.
6907+when window configuration request is complete.
6908+@end defvr
6909+
68626910 @defvr {Window Hook} property-notify-hook
68636911 Called whenever an X window property (not a Sawfish window property)
68646912 changes. In addition to the window, the hook is called with the
@@ -6866,7 +6914,7 @@ atom name and one of the symbols @code{new-value} or @code{deleted}.
68666914 @end defvr
68676915
68686916 @defvr {Window Hook} window-state-change-hook
6869-Called whenver certain window manager hints change for a window.
6917+Called whenever certain window manager hints change for a window.
68706918 Currently only @code{urgency} is monitored. The hint is an additional
68716919 argument to the hook.
68726920 @end defvr
@@ -6970,12 +7018,12 @@ possible.
69707018 @end defvr
69717019
69727020 @defvr {Hook} viewport-resized-hook
6973-Called when the number of rows and columns in each virtual workspace is
6974-changed.
7021+Hook called when the number of rows and columns in each
7022+workspace is changed.
69757023 @end defvr
69767024
69777025 @defvr {Hook} viewport-moved-hook
6978-Called when the origin of the viewport into the virtual workspace is
7026+Called when the origin of the viewport into the workspace is
69797027 moved.
69807028 @end defvr
69817029
--- a/src/display.c
+++ b/src/display.c
@@ -45,7 +45,7 @@
4545 #endif
4646
4747 char *visual_name;
48-Display *dpy = NULL;
48+Display *dpy;
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
@@ -76,7 +76,7 @@ static int has_randr = FALSE;
7676 static int randr_event_base; /* Will give us the offset for the xrandr events */
7777 #endif
7878
79-
79+/* variables */
8080 DEFSYM(visibility_notify_hook, "visibility-notify-hook");
8181 DEFSYM(destroy_notify_hook, "destroy-notify-hook");
8282 DEFSYM(map_notify_hook, "map-notify-hook");
@@ -97,11 +97,7 @@ DEFSYM(enter_frame_part_hook, "enter-frame-part-hook");
9797 DEFSYM(leave_frame_part_hook, "leave-frame-part-hook");
9898 DEFSYM(configure_request_hook, "configure-request-hook");
9999 DEFSYM(configure_notify_hook, "configure-notify-hook");
100-
101-#ifdef HAVE_X11_EXTENSIONS_XRANDR_H
102100 DEFSYM(randr_change_notify_hook, "randr-change-notify-hook");
103-#endif
104-
105101 DEFSYM(window_state_change_hook, "window-state-change-hook");
106102
107103 DEFSYM(pointer_motion_threshold, "pointer-motion-threshold");
@@ -1238,6 +1234,26 @@ configure_notify (XEvent *ev)
12381234 }
12391235 }
12401236
1237+#ifdef HAVE_X11_EXTENSIONS_XRANDR_H
1238+static void
1239+randr_screen_change_notify (XEvent *ev)
1240+{
1241+ /* If ev is XRRScreenChangeNotifyEvent, then it's a superior
1242+ version to XConfigureEvent one.
1243+ */
1244+ XRRUpdateConfiguration( ev );
1245+
1246+ update_xinerama_info();
1247+
1248+ int snum = DefaultScreen(dpy);
1249+ screen_width = DisplayWidth(dpy, snum);
1250+ screen_height = DisplayHeight(dpy, snum);
1251+
1252+ // Call the hook
1253+ Fcall_hook(Qrandr_change_notify_hook, Qnil, Qnil);
1254+}
1255+#endif
1256+
12411257 static void
12421258 create_notify (XEvent *ev)
12431259 {
@@ -1278,21 +1294,6 @@ shape_notify (XEvent *ev)
12781294 }
12791295 }
12801296
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
1295-
12961297 static int synthetic_configure_mutex;
12971298
12981299 /* From the afterstep sources, ``According to the July 27, 1988 ICCCM
@@ -1435,8 +1436,9 @@ inner_handle_input (repv arg)
14351436 else if (ev->type == shape_event_base + ShapeNotify)
14361437 shape_notify (ev);
14371438 #ifdef HAVE_X11_EXTENSIONS_XRANDR_H
1438- else if (ev->type == randr_event_base + RRScreenChangeNotify)
1439- randr_screen_change_notify(ev);
1439+ else if (ev->type == randr_event_base + RRScreenChangeNotify){
1440+ randr_screen_change_notify(ev);
1441+ }
14401442 #endif
14411443 else
14421444 fprintf (stderr, "warning: unhandled event: %d\n", ev->type);
@@ -1701,6 +1703,13 @@ DEFUN("clicked-frame-part", Fclicked_frame_part,
17011703 return (clicked_frame_part != 0) ? rep_VAL (clicked_frame_part) : Qnil;
17021704 }
17031705
1706+DEFUN("has-randr-p", Fhas_randr_p,
1707+ Shas_randr_p, (void), rep_Subr0)
1708+{
1709+ return has_randr ? Qt : Qnil;
1710+}
1711+
1712+
17041713 /* initialisation */
17051714
17061715 void
@@ -1715,14 +1724,13 @@ events_init (void)
17151724 #ifdef HAVE_X11_EXTENSIONS_XRANDR_H
17161725 // This code is executed even in batch mode, in
17171726 // which case dpy is not set
1718- if (dpy != NULL) {
1727+ if (dpy != 0) {
17191728 has_randr = XRRQueryExtension( dpy, &randr_event_base, &dummy );
17201729 if( has_randr )
17211730 {
17221731 int major, minor;
17231732 XRRQueryVersion( dpy, &major, &minor );
17241733 has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) );
1725- fprintf(stderr, "it Has randr %d\n", has_randr);
17261734 XRRSelectInput( dpy, root_window, RRScreenChangeNotifyMask );
17271735 }
17281736 }
@@ -1754,16 +1762,6 @@ events_init (void)
17541762 event_handlers[CirculateNotify] = circulate_notify;
17551763 event_handlers[MappingNotify] = mapping_notify;
17561764
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-
17671765 event_names[KeyPress] = "KeyPress";
17681766 event_names[KeyRelease] = "KeyRelease";
17691767 event_names[ButtonPress] = "ButtonPress";
@@ -1867,6 +1865,7 @@ events_init (void)
18671865 rep_INTERN_SPECIAL(configure_notify_hook);
18681866 rep_INTERN_SPECIAL(configure_request_hook);
18691867 rep_INTERN_SPECIAL(window_state_change_hook);
1868+ rep_INTERN_SPECIAL(randr_change_notify_hook);
18701869
18711870 rep_INTERN_SPECIAL(pointer_motion_threshold);
18721871
--- a/src/functions.c
+++ b/src/functions.c
@@ -52,7 +52,7 @@ static int xinerama_heads;
5252
5353 #ifdef HAVE_X11_EXTENSIONS_XINERAMA_H
5454 # include <X11/extensions/Xinerama.h>
55- static XineramaScreenInfo *xinerama_head_info;
55+ static XineramaScreenInfo *xinerama_head_info = NULL;
5656 # ifdef TEST_XINERAMA
5757 static XineramaScreenInfo debug_heads[2] = {
5858 { 0, 0, 0, 512, 768 },
@@ -948,7 +948,10 @@ update_xinerama_info (void)
948948 if (XineramaQueryExtension (dpy, &xinerama_event_base,
949949 &xinerama_error_base))
950950 {
951- xinerama_head_info = XineramaQueryScreens (dpy, &xinerama_heads);
951+ if(xinerama_head_info != NULL){
952+ XFree(xinerama_head_info);
953+ }
954+ xinerama_head_info = XineramaQueryScreens (dpy, &xinerama_heads);
952955 }
953956 }
954957 # else
--- a/src/sawfish_subrs.h
+++ b/src/sawfish_subrs.h
@@ -78,7 +78,7 @@ extern XEvent *current_x_event;
7878 extern repv Qvisibility_notify_hook, Qdestroy_notify_hook, Qmap_notify_hook,
7979 Qunmap_notify_hook, Qreparent_notify_hook, Qenter_notify_hook,
8080 Qleave_notify_hook, Qfocus_in_hook, Qfocus_out_hook, Qclient_message_hook,
81- Qwindow_moved_hook, Qwindow_resized_hook;
81+ Qwindow_moved_hook, Qwindow_resized_hook, Qrandr_change_notify_hook;
8282 extern repv Qiconify_window, Quniconify_window;
8383 extern struct frame_part *clicked_frame_part;
8484 extern void save_timestamp (Time t);