Japanese translation of message catalog for Sawfish Window-Manager
Revision | 45018829c8fea41bf75ab7f6ca003deb53e8d796 (tree) |
---|---|
Zeit | 2010-05-11 14:14:45 |
Autor | Teika kazura <teika@lava...> |
Commiter | Teika kazura |
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.
@@ -36,8 +36,8 @@ 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] | |
39 | +@item XRandR events (eg resolution changes) call the new hook | |
40 | +@code{randr-changed-notify-hook} [Daniel M. German] | |
41 | 41 | |
42 | 42 | @item Tabbed windowing system improvements [Fuchur] |
43 | 43 | @itemize + |
@@ -76,7 +76,7 @@ For edit history, see @file{ChangeLog} file. | ||
76 | 76 | * Window Frames:: Decorating windows |
77 | 77 | * Viewports:: Subdivided desktop areas |
78 | 78 | * Workspaces:: Multiple desktop areas |
79 | -* Multi-Head Environments:: Multiple monitors | |
79 | +* RandR and Xinerama:: Many monitors and updates | |
80 | 80 | * Window Placement:: Controlling placement of new windows |
81 | 81 | * Popup Menus:: Displaying menus |
82 | 82 | * Events:: Input event types |
@@ -4321,7 +4321,7 @@ When true, windows uniconify to the current viewport, rather than to | ||
4321 | 4321 | the viewport they were iconified on. Defaults to true. |
4322 | 4322 | @end defvr |
4323 | 4323 | |
4324 | -@node Workspaces, Multi-Head Environments, Viewports, Top | |
4324 | +@node Workspaces, RandR and Xinerama, Viewports, Top | |
4325 | 4325 | @chapter Workspaces |
4326 | 4326 | @cindex Workspaces |
4327 | 4327 | @cindex Desktop workspaces |
@@ -4741,21 +4741,43 @@ Add edge windows used to implement flipping. | ||
4741 | 4741 | Remove the edge windows used to implement flipping. |
4742 | 4742 | @end defun |
4743 | 4743 | |
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 | |
4746 | 4764 | @cindex Multi-head environments |
4747 | 4765 | @cindex Environments, multi-head |
4748 | 4766 | @cindex Monitors, multiple |
4749 | -@cindex Xinerama | |
4750 | 4767 | |
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. | |
4753 | 4775 | |
4754 | 4776 | A ``head'' means each physical monitor. When there're multiple heads, |
4755 | 4777 | the word ``screen'' means the entire screen which is the combination |
4756 | 4778 | of all heads. For example the function @code{screen-width} returns the |
4757 | 4779 | 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 | |
4759 | 4781 | head, unless stated explicitly that it's xinerama. |
4760 | 4782 | |
4761 | 4783 | @defun find-head x y |
@@ -4813,8 +4835,29 @@ containing the window @var{window}, or the pointer if @var{window} is | ||
4813 | 4835 | false). Returns @code{'(0 . 0)} if no such head can be identified. |
4814 | 4836 | @end defun |
4815 | 4837 | |
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. | |
4816 | 4850 | |
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 | |
4818 | 4861 | @chapter Window Placement |
4819 | 4862 | @cindex Placement of windows |
4820 | 4863 |
@@ -6859,6 +6902,11 @@ of configure request properties. This alist may contain items | ||
6859 | 6902 | and @code{(dimensions . @var{dimensions})}. |
6860 | 6903 | @end defvr |
6861 | 6904 | |
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 | + | |
6862 | 6910 | @defvr {Window Hook} property-notify-hook |
6863 | 6911 | Called whenever an X window property (not a Sawfish window property) |
6864 | 6912 | 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}. | ||
6866 | 6914 | @end defvr |
6867 | 6915 | |
6868 | 6916 | @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. | |
6870 | 6918 | Currently only @code{urgency} is monitored. The hint is an additional |
6871 | 6919 | argument to the hook. |
6872 | 6920 | @end defvr |
@@ -6970,12 +7018,12 @@ possible. | ||
6970 | 7018 | @end defvr |
6971 | 7019 | |
6972 | 7020 | @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. | |
6975 | 7023 | @end defvr |
6976 | 7024 | |
6977 | 7025 | @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 | |
6979 | 7027 | moved. |
6980 | 7028 | @end defvr |
6981 | 7029 |
@@ -45,7 +45,7 @@ | ||
45 | 45 | #endif |
46 | 46 | |
47 | 47 | char *visual_name; |
48 | -Display *dpy = NULL; | |
48 | +Display *dpy; | |
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; |
@@ -76,7 +76,7 @@ static int has_randr = FALSE; | ||
76 | 76 | static int randr_event_base; /* Will give us the offset for the xrandr events */ |
77 | 77 | #endif |
78 | 78 | |
79 | - | |
79 | +/* variables */ | |
80 | 80 | DEFSYM(visibility_notify_hook, "visibility-notify-hook"); |
81 | 81 | DEFSYM(destroy_notify_hook, "destroy-notify-hook"); |
82 | 82 | DEFSYM(map_notify_hook, "map-notify-hook"); |
@@ -97,11 +97,7 @@ DEFSYM(enter_frame_part_hook, "enter-frame-part-hook"); | ||
97 | 97 | DEFSYM(leave_frame_part_hook, "leave-frame-part-hook"); |
98 | 98 | DEFSYM(configure_request_hook, "configure-request-hook"); |
99 | 99 | DEFSYM(configure_notify_hook, "configure-notify-hook"); |
100 | - | |
101 | -#ifdef HAVE_X11_EXTENSIONS_XRANDR_H | |
102 | 100 | DEFSYM(randr_change_notify_hook, "randr-change-notify-hook"); |
103 | -#endif | |
104 | - | |
105 | 101 | DEFSYM(window_state_change_hook, "window-state-change-hook"); |
106 | 102 | |
107 | 103 | DEFSYM(pointer_motion_threshold, "pointer-motion-threshold"); |
@@ -1238,6 +1234,26 @@ configure_notify (XEvent *ev) | ||
1238 | 1234 | } |
1239 | 1235 | } |
1240 | 1236 | |
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 | + | |
1241 | 1257 | static void |
1242 | 1258 | create_notify (XEvent *ev) |
1243 | 1259 | { |
@@ -1278,21 +1294,6 @@ shape_notify (XEvent *ev) | ||
1278 | 1294 | } |
1279 | 1295 | } |
1280 | 1296 | |
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 | - | |
1296 | 1297 | static int synthetic_configure_mutex; |
1297 | 1298 | |
1298 | 1299 | /* From the afterstep sources, ``According to the July 27, 1988 ICCCM |
@@ -1435,8 +1436,9 @@ inner_handle_input (repv arg) | ||
1435 | 1436 | else if (ev->type == shape_event_base + ShapeNotify) |
1436 | 1437 | shape_notify (ev); |
1437 | 1438 | #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 | + } | |
1440 | 1442 | #endif |
1441 | 1443 | else |
1442 | 1444 | fprintf (stderr, "warning: unhandled event: %d\n", ev->type); |
@@ -1701,6 +1703,13 @@ DEFUN("clicked-frame-part", Fclicked_frame_part, | ||
1701 | 1703 | return (clicked_frame_part != 0) ? rep_VAL (clicked_frame_part) : Qnil; |
1702 | 1704 | } |
1703 | 1705 | |
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 | + | |
1704 | 1713 | /* initialisation */ |
1705 | 1714 | |
1706 | 1715 | void |
@@ -1715,14 +1724,13 @@ events_init (void) | ||
1715 | 1724 | #ifdef HAVE_X11_EXTENSIONS_XRANDR_H |
1716 | 1725 | // This code is executed even in batch mode, in |
1717 | 1726 | // which case dpy is not set |
1718 | - if (dpy != NULL) { | |
1727 | + if (dpy != 0) { | |
1719 | 1728 | has_randr = XRRQueryExtension( dpy, &randr_event_base, &dummy ); |
1720 | 1729 | if( has_randr ) |
1721 | 1730 | { |
1722 | 1731 | int major, minor; |
1723 | 1732 | XRRQueryVersion( dpy, &major, &minor ); |
1724 | 1733 | has_randr = ( major > 1 || ( major == 1 && minor >= 1 ) ); |
1725 | - fprintf(stderr, "it Has randr %d\n", has_randr); | |
1726 | 1734 | XRRSelectInput( dpy, root_window, RRScreenChangeNotifyMask ); |
1727 | 1735 | } |
1728 | 1736 | } |
@@ -1754,16 +1762,6 @@ events_init (void) | ||
1754 | 1762 | event_handlers[CirculateNotify] = circulate_notify; |
1755 | 1763 | event_handlers[MappingNotify] = mapping_notify; |
1756 | 1764 | |
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 | - | |
1767 | 1765 | event_names[KeyPress] = "KeyPress"; |
1768 | 1766 | event_names[KeyRelease] = "KeyRelease"; |
1769 | 1767 | event_names[ButtonPress] = "ButtonPress"; |
@@ -1867,6 +1865,7 @@ events_init (void) | ||
1867 | 1865 | rep_INTERN_SPECIAL(configure_notify_hook); |
1868 | 1866 | rep_INTERN_SPECIAL(configure_request_hook); |
1869 | 1867 | rep_INTERN_SPECIAL(window_state_change_hook); |
1868 | + rep_INTERN_SPECIAL(randr_change_notify_hook); | |
1870 | 1869 | |
1871 | 1870 | rep_INTERN_SPECIAL(pointer_motion_threshold); |
1872 | 1871 |
@@ -52,7 +52,7 @@ static int xinerama_heads; | ||
52 | 52 | |
53 | 53 | #ifdef HAVE_X11_EXTENSIONS_XINERAMA_H |
54 | 54 | # include <X11/extensions/Xinerama.h> |
55 | - static XineramaScreenInfo *xinerama_head_info; | |
55 | + static XineramaScreenInfo *xinerama_head_info = NULL; | |
56 | 56 | # ifdef TEST_XINERAMA |
57 | 57 | static XineramaScreenInfo debug_heads[2] = { |
58 | 58 | { 0, 0, 0, 512, 768 }, |
@@ -948,7 +948,10 @@ update_xinerama_info (void) | ||
948 | 948 | if (XineramaQueryExtension (dpy, &xinerama_event_base, |
949 | 949 | &xinerama_error_base)) |
950 | 950 | { |
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); | |
952 | 955 | } |
953 | 956 | } |
954 | 957 | # else |
@@ -78,7 +78,7 @@ extern XEvent *current_x_event; | ||
78 | 78 | extern repv Qvisibility_notify_hook, Qdestroy_notify_hook, Qmap_notify_hook, |
79 | 79 | Qunmap_notify_hook, Qreparent_notify_hook, Qenter_notify_hook, |
80 | 80 | 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; | |
82 | 82 | extern repv Qiconify_window, Quniconify_window; |
83 | 83 | extern struct frame_part *clicked_frame_part; |
84 | 84 | extern void save_timestamp (Time t); |