diff options
| author | Jan Djärv | 2009-03-27 18:40:04 +0000 |
|---|---|---|
| committer | Jan Djärv | 2009-03-27 18:40:04 +0000 |
| commit | 46dfb8fbad2fa4dd046c877bf37baf3605b69918 (patch) | |
| tree | fb8e13d0cd8d1aeb359522cd7346c078987324a8 /src | |
| parent | fc82c45286df73db3e3240fd1b8c71152d531004 (diff) | |
| download | emacs-46dfb8fbad2fa4dd046c877bf37baf3605b69918.tar.gz emacs-46dfb8fbad2fa4dd046c877bf37baf3605b69918.zip | |
(handle_one_xevent): Call x_handle_net_wm_state if
the property _NET_WM_STATE has changed.
updated.
(x_handle_net_wm_state): New function to update frame parameter
fullscreen.
(x_term_init): Initialize atoms for _NET_WM_STATE.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/xterm.c | 77 |
2 files changed, 91 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 93a3810d3bd..fa0edf01055 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2009-03-27 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * frame.c (x_set_font): If the fullscreen property is non-nil, adjust | ||
| 4 | lines and columns so we keep the same pixel height and width. | ||
| 5 | |||
| 6 | * xterm.c (handle_one_xevent): Call x_handle_net_wm_state if | ||
| 7 | the property _NET_WM_STATE has changed. | ||
| 8 | updated. | ||
| 9 | (x_handle_net_wm_state): New function to update frame parameter | ||
| 10 | fullscreen. | ||
| 11 | (x_term_init): Initialize atoms for _NET_WM_STATE. | ||
| 12 | |||
| 13 | * xterm.h (struct x_display_info): Add atoms for _NET_WM_STATE. | ||
| 14 | |||
| 1 | 2009-03-27 Kevin Ryde <user42@zip.com.au> | 15 | 2009-03-27 Kevin Ryde <user42@zip.com.au> |
| 2 | 16 | ||
| 3 | * keyboard.c (tty_read_avail_input): Don't treat a -1 return from | 17 | * keyboard.c (tty_read_avail_input): Don't treat a -1 return from |
diff --git a/src/xterm.c b/src/xterm.c index 00064758cdc..76beb62e4e3 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -363,6 +363,7 @@ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, | |||
| 363 | enum scroll_bar_part *, | 363 | enum scroll_bar_part *, |
| 364 | Lisp_Object *, Lisp_Object *, | 364 | Lisp_Object *, Lisp_Object *, |
| 365 | unsigned long *)); | 365 | unsigned long *)); |
| 366 | static void x_handle_net_wm_state P_ ((struct frame *, XPropertyEvent *)); | ||
| 366 | static void x_check_fullscreen P_ ((struct frame *)); | 367 | static void x_check_fullscreen P_ ((struct frame *)); |
| 367 | static void x_check_expected_move P_ ((struct frame *, int, int)); | 368 | static void x_check_expected_move P_ ((struct frame *, int, int)); |
| 368 | static void x_sync_with_move P_ ((struct frame *, int, int, int)); | 369 | static void x_sync_with_move P_ ((struct frame *, int, int, int)); |
| @@ -6096,6 +6097,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6096 | goto OTHER; | 6097 | goto OTHER; |
| 6097 | #endif | 6098 | #endif |
| 6098 | #endif | 6099 | #endif |
| 6100 | f = x_top_window_to_frame (dpyinfo, event.xproperty.window); | ||
| 6101 | if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) | ||
| 6102 | x_handle_net_wm_state (f, &event.xproperty); | ||
| 6103 | |||
| 6099 | x_handle_property_notify (&event.xproperty); | 6104 | x_handle_property_notify (&event.xproperty); |
| 6100 | goto OTHER; | 6105 | goto OTHER; |
| 6101 | 6106 | ||
| @@ -8656,6 +8661,69 @@ XTfullscreen_hook (f) | |||
| 8656 | } | 8661 | } |
| 8657 | 8662 | ||
| 8658 | 8663 | ||
| 8664 | extern Lisp_Object Qfullwidth, Qfullheight, Qfullboth; | ||
| 8665 | static void | ||
| 8666 | x_handle_net_wm_state (f, event) | ||
| 8667 | struct frame *f; | ||
| 8668 | XPropertyEvent *event; | ||
| 8669 | { | ||
| 8670 | Atom actual_type; | ||
| 8671 | unsigned long actual_size, bytes_remaining; | ||
| 8672 | int i, rc, actual_format, value = 0; | ||
| 8673 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 8674 | long max_len = 65536; | ||
| 8675 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 8676 | unsigned char *tmp_data = NULL; | ||
| 8677 | Atom target_type = XA_ATOM; | ||
| 8678 | |||
| 8679 | BLOCK_INPUT; | ||
| 8680 | x_catch_errors (dpy); | ||
| 8681 | rc = XGetWindowProperty (dpy, event->window, | ||
| 8682 | event->atom, 0, max_len, False, target_type, | ||
| 8683 | &actual_type, &actual_format, &actual_size, | ||
| 8684 | &bytes_remaining, &tmp_data); | ||
| 8685 | |||
| 8686 | if (rc != Success || actual_type != target_type || x_had_errors_p (dpy)) | ||
| 8687 | { | ||
| 8688 | if (tmp_data) XFree (tmp_data); | ||
| 8689 | x_uncatch_errors (); | ||
| 8690 | UNBLOCK_INPUT; | ||
| 8691 | return; | ||
| 8692 | } | ||
| 8693 | |||
| 8694 | x_uncatch_errors (); | ||
| 8695 | |||
| 8696 | for (i = 0; i < actual_size; ++i) | ||
| 8697 | { | ||
| 8698 | Atom a = ((Atom*)tmp_data)[i]; | ||
| 8699 | if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) | ||
| 8700 | value |= FULLSCREEN_WIDTH; | ||
| 8701 | else if (a == dpyinfo->Xatom_net_wm_state_maximized_vert) | ||
| 8702 | value |= FULLSCREEN_HEIGHT; | ||
| 8703 | else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) | ||
| 8704 | value |= FULLSCREEN_BOTH; | ||
| 8705 | } | ||
| 8706 | |||
| 8707 | Lisp_Object lval = Qnil; | ||
| 8708 | switch (value) | ||
| 8709 | { | ||
| 8710 | case FULLSCREEN_WIDTH: | ||
| 8711 | lval = Qfullwidth; | ||
| 8712 | break; | ||
| 8713 | case FULLSCREEN_HEIGHT: | ||
| 8714 | lval = Qfullheight; | ||
| 8715 | break; | ||
| 8716 | case FULLSCREEN_BOTH: | ||
| 8717 | lval = Qfullboth; | ||
| 8718 | break; | ||
| 8719 | } | ||
| 8720 | |||
| 8721 | store_frame_param (f, Qfullscreen, lval); | ||
| 8722 | |||
| 8723 | if (tmp_data) XFree (tmp_data); | ||
| 8724 | UNBLOCK_INPUT; | ||
| 8725 | } | ||
| 8726 | |||
| 8659 | /* Check if we need to resize the frame due to a fullscreen request. | 8727 | /* Check if we need to resize the frame due to a fullscreen request. |
| 8660 | If so needed, resize the frame. */ | 8728 | If so needed, resize the frame. */ |
| 8661 | static void | 8729 | static void |
| @@ -10350,6 +10418,15 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 10350 | dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", | 10418 | dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED", |
| 10351 | False); | 10419 | False); |
| 10352 | 10420 | ||
| 10421 | dpyinfo->Xatom_net_wm_state | ||
| 10422 | = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False); | ||
| 10423 | dpyinfo->Xatom_net_wm_state_fullscreen_atom | ||
| 10424 | = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False); | ||
| 10425 | dpyinfo->Xatom_net_wm_state_maximized_horz | ||
| 10426 | = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); | ||
| 10427 | dpyinfo->Xatom_net_wm_state_maximized_vert | ||
| 10428 | = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False); | ||
| 10429 | |||
| 10353 | dpyinfo->cut_buffers_initialized = 0; | 10430 | dpyinfo->cut_buffers_initialized = 0; |
| 10354 | 10431 | ||
| 10355 | dpyinfo->x_dnd_atoms_size = 8; | 10432 | dpyinfo->x_dnd_atoms_size = 8; |