diff options
| author | Jan Djärv | 2006-11-10 08:01:33 +0000 |
|---|---|---|
| committer | Jan Djärv | 2006-11-10 08:01:33 +0000 |
| commit | b8e7655fa8121b5ee6d6314d66b3998412791d10 (patch) | |
| tree | 4708d9875916206f067a71161043b964462920f4 /src | |
| parent | b74772d489b4408b690942a3cf721538e6891398 (diff) | |
| download | emacs-b8e7655fa8121b5ee6d6314d66b3998412791d10.tar.gz emacs-b8e7655fa8121b5ee6d6314d66b3998412791d10.zip | |
(do_ewmh_fullscreen, XTfullscreen_hook): New functions.
(x_check_fullscreen): Call do_ewmh_fullscreen.
(x_initialize): Set fullscreen_hook to XTfullscreen_hook.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 15 | ||||
| -rw-r--r-- | src/xterm.c | 116 |
2 files changed, 131 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d5c02729b54..c21a76b7c87 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2006-11-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xterm.h (struct x_display_info): Fix indentation. | ||
| 4 | |||
| 5 | * xterm.c (do_ewmh_fullscreen, XTfullscreen_hook): New functions. | ||
| 6 | (x_check_fullscreen): Call do_ewmh_fullscreen. | ||
| 7 | (x_initialize): Set fullscreen_hook to XTfullscreen_hook. | ||
| 8 | |||
| 9 | * frame.c (x_set_fullscreen): Call fullscreen_hook if set. | ||
| 10 | |||
| 11 | * term.c: Define fullscreen_hook. | ||
| 12 | (syms_of_term): Initialize fullscreen_hook to NULL. | ||
| 13 | |||
| 14 | * termhooks.h: Add fullscreen_hook. | ||
| 15 | |||
| 1 | 2006-11-08 Juanma Barranquero <lekktu@gmail.com> | 16 | 2006-11-08 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 17 | ||
| 3 | * bytecode.c (Fbyte_code): | 18 | * bytecode.c (Fbyte_code): |
diff --git a/src/xterm.c b/src/xterm.c index 564da0d876c..7d86168f01f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8296,6 +8296,118 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 8296 | UNBLOCK_INPUT; | 8296 | UNBLOCK_INPUT; |
| 8297 | } | 8297 | } |
| 8298 | 8298 | ||
| 8299 | /* Do fullscreen as specified in extended window manager hints */ | ||
| 8300 | static int | ||
| 8301 | do_ewmh_fullscreen (f) | ||
| 8302 | struct frame *f; | ||
| 8303 | { | ||
| 8304 | int have_net_atom = FRAME_X_DISPLAY_INFO (f)->have_net_atoms; | ||
| 8305 | |||
| 8306 | if (!have_net_atom) | ||
| 8307 | { | ||
| 8308 | int num; | ||
| 8309 | Atom *atoms = XListProperties (FRAME_X_DISPLAY (f), | ||
| 8310 | FRAME_X_DISPLAY_INFO (f)->root_window, | ||
| 8311 | &num); | ||
| 8312 | if (atoms && num > 0) | ||
| 8313 | { | ||
| 8314 | char **names = (char **) xmalloc (num * sizeof(*names)); | ||
| 8315 | if (XGetAtomNames (FRAME_X_DISPLAY (f), atoms, num, names)) | ||
| 8316 | { | ||
| 8317 | int i; | ||
| 8318 | for (i = 0; i < num; ++i) | ||
| 8319 | { | ||
| 8320 | if (!have_net_atom) | ||
| 8321 | have_net_atom = strncmp (names[i], "_NET_", 5) == 0; | ||
| 8322 | XFree (names[i]); | ||
| 8323 | } | ||
| 8324 | } | ||
| 8325 | xfree (names); | ||
| 8326 | } | ||
| 8327 | if (atoms) | ||
| 8328 | XFree (atoms); | ||
| 8329 | |||
| 8330 | FRAME_X_DISPLAY_INFO (f)->have_net_atoms = have_net_atom; | ||
| 8331 | } | ||
| 8332 | |||
| 8333 | if (have_net_atom) | ||
| 8334 | { | ||
| 8335 | Lisp_Object frame; | ||
| 8336 | XSETFRAME (frame, f); | ||
| 8337 | const char *atom = "_NET_WM_STATE"; | ||
| 8338 | const char *fs = "_NET_WM_STATE_FULLSCREEN"; | ||
| 8339 | const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ"; | ||
| 8340 | const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT"; | ||
| 8341 | const char *what = NULL; | ||
| 8342 | |||
| 8343 | /* If there are _NET_ atoms we assume we have extended window manager | ||
| 8344 | hints. */ | ||
| 8345 | switch (f->want_fullscreen) | ||
| 8346 | { | ||
| 8347 | case FULLSCREEN_BOTH: | ||
| 8348 | what = fs; | ||
| 8349 | break; | ||
| 8350 | case FULLSCREEN_WIDTH: | ||
| 8351 | what = fw; | ||
| 8352 | break; | ||
| 8353 | case FULLSCREEN_HEIGHT: | ||
| 8354 | what = fh; | ||
| 8355 | break; | ||
| 8356 | } | ||
| 8357 | |||
| 8358 | Fx_send_client_event (frame, make_number (0), frame, | ||
| 8359 | make_unibyte_string (atom, strlen (atom)), | ||
| 8360 | make_number (32), | ||
| 8361 | Fcons (make_number (0), /* Remove */ | ||
| 8362 | Fcons | ||
| 8363 | (make_unibyte_string (fs, | ||
| 8364 | strlen (fs)), | ||
| 8365 | Qnil))); | ||
| 8366 | Fx_send_client_event (frame, make_number (0), frame, | ||
| 8367 | make_unibyte_string (atom, strlen (atom)), | ||
| 8368 | make_number (32), | ||
| 8369 | Fcons (make_number (0), /* Remove */ | ||
| 8370 | Fcons | ||
| 8371 | (make_unibyte_string (fh, | ||
| 8372 | strlen (fh)), | ||
| 8373 | Qnil))); | ||
| 8374 | Fx_send_client_event (frame, make_number (0), frame, | ||
| 8375 | make_unibyte_string (atom, strlen (atom)), | ||
| 8376 | make_number (32), | ||
| 8377 | Fcons (make_number (0), /* Remove */ | ||
| 8378 | Fcons | ||
| 8379 | (make_unibyte_string (fw, | ||
| 8380 | strlen (fw)), | ||
| 8381 | Qnil))); | ||
| 8382 | f->want_fullscreen = FULLSCREEN_NONE; | ||
| 8383 | if (what != NULL) | ||
| 8384 | Fx_send_client_event (frame, make_number (0), frame, | ||
| 8385 | make_unibyte_string (atom, strlen (atom)), | ||
| 8386 | make_number (32), | ||
| 8387 | Fcons (make_number (1), /* Add */ | ||
| 8388 | Fcons | ||
| 8389 | (make_unibyte_string (what, | ||
| 8390 | strlen (what)), | ||
| 8391 | Qnil))); | ||
| 8392 | } | ||
| 8393 | |||
| 8394 | return have_net_atom; | ||
| 8395 | } | ||
| 8396 | |||
| 8397 | static void | ||
| 8398 | XTfullscreen_hook (f) | ||
| 8399 | FRAME_PTR f; | ||
| 8400 | { | ||
| 8401 | if (f->async_visible) | ||
| 8402 | { | ||
| 8403 | BLOCK_INPUT; | ||
| 8404 | do_ewmh_fullscreen (f); | ||
| 8405 | x_sync (f); | ||
| 8406 | UNBLOCK_INPUT; | ||
| 8407 | } | ||
| 8408 | } | ||
| 8409 | |||
| 8410 | |||
| 8299 | /* Check if we need to resize the frame due to a fullscreen request. | 8411 | /* Check if we need to resize the frame due to a fullscreen request. |
| 8300 | If so needed, resize the frame. */ | 8412 | If so needed, resize the frame. */ |
| 8301 | static void | 8413 | static void |
| @@ -8306,6 +8418,9 @@ x_check_fullscreen (f) | |||
| 8306 | { | 8418 | { |
| 8307 | int width, height, ign; | 8419 | int width, height, ign; |
| 8308 | 8420 | ||
| 8421 | if (do_ewmh_fullscreen (f)) | ||
| 8422 | return; | ||
| 8423 | |||
| 8309 | x_real_positions (f, &f->left_pos, &f->top_pos); | 8424 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 8310 | 8425 | ||
| 8311 | x_fullscreen_adjust (f, &width, &height, &ign, &ign); | 8426 | x_fullscreen_adjust (f, &width, &height, &ign, &ign); |
| @@ -10935,6 +11050,7 @@ x_initialize () | |||
| 10935 | condemn_scroll_bars_hook = XTcondemn_scroll_bars; | 11050 | condemn_scroll_bars_hook = XTcondemn_scroll_bars; |
| 10936 | redeem_scroll_bar_hook = XTredeem_scroll_bar; | 11051 | redeem_scroll_bar_hook = XTredeem_scroll_bar; |
| 10937 | judge_scroll_bars_hook = XTjudge_scroll_bars; | 11052 | judge_scroll_bars_hook = XTjudge_scroll_bars; |
| 11053 | fullscreen_hook = XTfullscreen_hook; | ||
| 10938 | 11054 | ||
| 10939 | scroll_region_ok = 1; /* we'll scroll partial frames */ | 11055 | scroll_region_ok = 1; /* we'll scroll partial frames */ |
| 10940 | char_ins_del_ok = 1; | 11056 | char_ins_del_ok = 1; |