Mercurial > emacs
comparison src/xterm.c @ 83548:c71725faff1a
Merged from emacs@sv.gnu.org. Last-minute emacsclient rewrites be damned!
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-490
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-491
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-492
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-493
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-494
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-495
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-496
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-497
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-498
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-499
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-500
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-501
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-502
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-503
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-504
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-505
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-506
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-507
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-508
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-509
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-510
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-511
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-512
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-513
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-514
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-515
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-516
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-517
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-518
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-519
Update from CVS: etc/TUTORIAL.cn: Updated.
* emacs@sv.gnu.org/emacs--devo--0--patch-520
Merge from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-521
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-522
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-523
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-524
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-525
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-526
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-527
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-528
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-529
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-530
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-531
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-532
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-533
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-534
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-535
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-161
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-162
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-163
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-164
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-165
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-166
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-167
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-168
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-169
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-170
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-588
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 03 Dec 2006 15:03:30 +0000 |
parents | 2d56e13fd23d 5d7f02605edd |
children | 17e0dd217877 |
comparison
equal
deleted
inserted
replaced
83547:0912b745fc75 | 83548:c71725faff1a |
---|---|
8334 x_check_expected_move (f, modified_left, modified_top); | 8334 x_check_expected_move (f, modified_left, modified_top); |
8335 | 8335 |
8336 UNBLOCK_INPUT; | 8336 UNBLOCK_INPUT; |
8337 } | 8337 } |
8338 | 8338 |
8339 /* Do fullscreen as specified in extended window manager hints */ | |
8340 static int | |
8341 do_ewmh_fullscreen (f) | |
8342 struct frame *f; | |
8343 { | |
8344 int have_net_atom = FRAME_X_DISPLAY_INFO (f)->have_net_atoms; | |
8345 | |
8346 if (!have_net_atom) | |
8347 { | |
8348 int num; | |
8349 Atom *atoms = XListProperties (FRAME_X_DISPLAY (f), | |
8350 FRAME_X_DISPLAY_INFO (f)->root_window, | |
8351 &num); | |
8352 if (atoms && num > 0) | |
8353 { | |
8354 char **names = (char **) xmalloc (num * sizeof(*names)); | |
8355 if (XGetAtomNames (FRAME_X_DISPLAY (f), atoms, num, names)) | |
8356 { | |
8357 int i; | |
8358 for (i = 0; i < num; ++i) | |
8359 { | |
8360 if (!have_net_atom) | |
8361 have_net_atom = strncmp (names[i], "_NET_", 5) == 0; | |
8362 XFree (names[i]); | |
8363 } | |
8364 } | |
8365 xfree (names); | |
8366 } | |
8367 if (atoms) | |
8368 XFree (atoms); | |
8369 | |
8370 FRAME_X_DISPLAY_INFO (f)->have_net_atoms = have_net_atom; | |
8371 } | |
8372 | |
8373 if (have_net_atom) | |
8374 { | |
8375 Lisp_Object frame; | |
8376 const char *atom = "_NET_WM_STATE"; | |
8377 const char *fs = "_NET_WM_STATE_FULLSCREEN"; | |
8378 const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ"; | |
8379 const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT"; | |
8380 const char *what = NULL; | |
8381 | |
8382 XSETFRAME (frame, f); | |
8383 | |
8384 /* If there are _NET_ atoms we assume we have extended window manager | |
8385 hints. */ | |
8386 switch (f->want_fullscreen) | |
8387 { | |
8388 case FULLSCREEN_BOTH: | |
8389 what = fs; | |
8390 break; | |
8391 case FULLSCREEN_WIDTH: | |
8392 what = fw; | |
8393 break; | |
8394 case FULLSCREEN_HEIGHT: | |
8395 what = fh; | |
8396 break; | |
8397 } | |
8398 | |
8399 Fx_send_client_event (frame, make_number (0), frame, | |
8400 make_unibyte_string (atom, strlen (atom)), | |
8401 make_number (32), | |
8402 Fcons (make_number (0), /* Remove */ | |
8403 Fcons | |
8404 (make_unibyte_string (fs, | |
8405 strlen (fs)), | |
8406 Qnil))); | |
8407 Fx_send_client_event (frame, make_number (0), frame, | |
8408 make_unibyte_string (atom, strlen (atom)), | |
8409 make_number (32), | |
8410 Fcons (make_number (0), /* Remove */ | |
8411 Fcons | |
8412 (make_unibyte_string (fh, | |
8413 strlen (fh)), | |
8414 Qnil))); | |
8415 Fx_send_client_event (frame, make_number (0), frame, | |
8416 make_unibyte_string (atom, strlen (atom)), | |
8417 make_number (32), | |
8418 Fcons (make_number (0), /* Remove */ | |
8419 Fcons | |
8420 (make_unibyte_string (fw, | |
8421 strlen (fw)), | |
8422 Qnil))); | |
8423 f->want_fullscreen = FULLSCREEN_NONE; | |
8424 if (what != NULL) | |
8425 Fx_send_client_event (frame, make_number (0), frame, | |
8426 make_unibyte_string (atom, strlen (atom)), | |
8427 make_number (32), | |
8428 Fcons (make_number (1), /* Add */ | |
8429 Fcons | |
8430 (make_unibyte_string (what, | |
8431 strlen (what)), | |
8432 Qnil))); | |
8433 } | |
8434 | |
8435 return have_net_atom; | |
8436 } | |
8437 | |
8438 static void | |
8439 XTfullscreen_hook (f) | |
8440 FRAME_PTR f; | |
8441 { | |
8442 if (f->async_visible) | |
8443 { | |
8444 BLOCK_INPUT; | |
8445 do_ewmh_fullscreen (f); | |
8446 x_sync (f); | |
8447 UNBLOCK_INPUT; | |
8448 } | |
8449 } | |
8450 | |
8451 | |
8339 /* Check if we need to resize the frame due to a fullscreen request. | 8452 /* Check if we need to resize the frame due to a fullscreen request. |
8340 If so needed, resize the frame. */ | 8453 If so needed, resize the frame. */ |
8341 static void | 8454 static void |
8342 x_check_fullscreen (f) | 8455 x_check_fullscreen (f) |
8343 struct frame *f; | 8456 struct frame *f; |
8344 { | 8457 { |
8345 if (f->want_fullscreen & FULLSCREEN_BOTH) | 8458 if (f->want_fullscreen & FULLSCREEN_BOTH) |
8346 { | 8459 { |
8347 int width, height, ign; | 8460 int width, height, ign; |
8461 | |
8462 if (do_ewmh_fullscreen (f)) | |
8463 return; | |
8348 | 8464 |
8349 x_real_positions (f, &f->left_pos, &f->top_pos); | 8465 x_real_positions (f, &f->left_pos, &f->top_pos); |
8350 | 8466 |
8351 x_fullscreen_adjust (f, &width, &height, &ign, &ign); | 8467 x_fullscreen_adjust (f, &width, &height, &ign, &ign); |
8352 | 8468 |
8645 | 8761 |
8646 void | 8762 void |
8647 x_raise_frame (f) | 8763 x_raise_frame (f) |
8648 struct frame *f; | 8764 struct frame *f; |
8649 { | 8765 { |
8766 BLOCK_INPUT; | |
8650 if (f->async_visible) | 8767 if (f->async_visible) |
8651 { | 8768 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); |
8652 BLOCK_INPUT; | 8769 |
8653 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); | 8770 XFlush (FRAME_X_DISPLAY (f)); |
8654 XFlush (FRAME_X_DISPLAY (f)); | 8771 UNBLOCK_INPUT; |
8655 UNBLOCK_INPUT; | |
8656 } | |
8657 } | 8772 } |
8658 | 8773 |
8659 /* Lower frame F. */ | 8774 /* Lower frame F. */ |
8660 | 8775 |
8661 void | 8776 void |
8675 XTframe_raise_lower (f, raise_flag) | 8790 XTframe_raise_lower (f, raise_flag) |
8676 FRAME_PTR f; | 8791 FRAME_PTR f; |
8677 int raise_flag; | 8792 int raise_flag; |
8678 { | 8793 { |
8679 if (raise_flag) | 8794 if (raise_flag) |
8680 x_raise_frame (f); | 8795 { |
8796 Lisp_Object frame; | |
8797 const char *atom = "_NET_ACTIVE_WINDOW"; | |
8798 | |
8799 x_raise_frame (f); | |
8800 /* See Window Manager Specification/Extended Window Manager Hints at | |
8801 http://freedesktop.org/wiki/Standards_2fwm_2dspec */ | |
8802 | |
8803 XSETFRAME (frame, f); | |
8804 Fx_send_client_event (frame, make_number (0), frame, | |
8805 make_unibyte_string (atom, strlen (atom)), | |
8806 make_number (32), | |
8807 Fcons (make_number (1), | |
8808 Fcons (make_number (time (NULL) * 1000), | |
8809 Qnil))); | |
8810 } | |
8681 else | 8811 else |
8682 x_lower_frame (f); | 8812 x_lower_frame (f); |
8683 } | 8813 } |
8684 | 8814 |
8685 /* Change of visibility. */ | 8815 /* Change of visibility. */ |
11036 terminal->read_socket_hook = XTread_socket; | 11166 terminal->read_socket_hook = XTread_socket; |
11037 terminal->frame_up_to_date_hook = XTframe_up_to_date; | 11167 terminal->frame_up_to_date_hook = XTframe_up_to_date; |
11038 terminal->mouse_position_hook = XTmouse_position; | 11168 terminal->mouse_position_hook = XTmouse_position; |
11039 terminal->frame_rehighlight_hook = XTframe_rehighlight; | 11169 terminal->frame_rehighlight_hook = XTframe_rehighlight; |
11040 terminal->frame_raise_lower_hook = XTframe_raise_lower; | 11170 terminal->frame_raise_lower_hook = XTframe_raise_lower; |
11171 terminal->fullscreen_hook = XTfullscreen_hook; | |
11041 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; | 11172 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; |
11042 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; | 11173 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; |
11043 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; | 11174 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; |
11044 terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; | 11175 terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; |
11045 | 11176 |