diff options
| author | Jan Djärv | 2009-09-02 17:03:20 +0000 |
|---|---|---|
| committer | Jan Djärv | 2009-09-02 17:03:20 +0000 |
| commit | a54fa5b720201e4717d0177821b8defcdad3d916 (patch) | |
| tree | 4a7d1cdc14db3901249131831cb0685c40a665f2 /src | |
| parent | ccfa8d36e63ce4983b90013ed6dbe092d0ca50fa (diff) | |
| download | emacs-a54fa5b720201e4717d0177821b8defcdad3d916.tar.gz emacs-a54fa5b720201e4717d0177821b8defcdad3d916.zip | |
* xterm.h: Rename x_non_menubar_window_to_frame to
x_menubar_window_to_frame
* xterm.c: Remove declarations also in xterm.h
(XTmouse_position): Do not return valid positions
for clicks in the menubar and the toolbar for Gtk+.
* xfns.c (x_any_window_to_frame): Assume less about Gtk+ internals,
if the widget for the event has the same top level as a frame,
return the frame.
(x_menubar_window_to_frame): Detect menu bar even with Gtk+
internal windows, bug #4122.
(x_non_menubar_window_to_frame): Remove.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/xfns.c | 64 | ||||
| -rw-r--r-- | src/xterm.c | 22 | ||||
| -rw-r--r-- | src/xterm.h | 2 |
4 files changed, 37 insertions, 67 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 29943f4e370..9dd82c590f8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2009-09-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xterm.h: Rename x_non_menubar_window_to_frame to | ||
| 4 | x_menubar_window_to_frame | ||
| 5 | |||
| 6 | * xterm.c: Remove declarations also in xterm.h | ||
| 7 | (XTmouse_position): Do not return valid positions | ||
| 8 | for clicks in the menubar and the toolbar for Gtk+. | ||
| 9 | |||
| 10 | * xfns.c (x_any_window_to_frame): Assume less about Gtk+ internals, | ||
| 11 | if the widget for the event has the same top level as a frame, | ||
| 12 | return the frame. | ||
| 13 | (x_menubar_window_to_frame): Detect menu bar even with Gtk+ | ||
| 14 | internal windows, bug #4122. | ||
| 15 | (x_non_menubar_window_to_frame): Remove. | ||
| 16 | |||
| 1 | 2009-09-02 Glenn Morris <rgm@gnu.org> | 17 | 2009-09-02 Glenn Morris <rgm@gnu.org> |
| 2 | 18 | ||
| 3 | * buffer.c (default-major-mode): Move most of the doc from here... | 19 | * buffer.c (default-major-mode): Move most of the doc from here... |
diff --git a/src/xfns.c b/src/xfns.c index ed068b1ca23..49a9c50f160 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -377,10 +377,7 @@ x_any_window_to_frame (dpyinfo, wdesc) | |||
| 377 | #ifdef USE_GTK | 377 | #ifdef USE_GTK |
| 378 | GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); | 378 | GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); |
| 379 | if (gwdesc != 0 | 379 | if (gwdesc != 0 |
| 380 | && (gwdesc == x->widget | 380 | && gtk_widget_get_toplevel (gwdesc) == x->widget) |
| 381 | || gwdesc == x->edit_widget | ||
| 382 | || gwdesc == x->vbox_widget | ||
| 383 | || gwdesc == x->menubar_widget)) | ||
| 384 | found = f; | 381 | found = f; |
| 385 | #else | 382 | #else |
| 386 | if (wdesc == XtWindow (x->widget) | 383 | if (wdesc == XtWindow (x->widget) |
| @@ -401,54 +398,6 @@ x_any_window_to_frame (dpyinfo, wdesc) | |||
| 401 | return found; | 398 | return found; |
| 402 | } | 399 | } |
| 403 | 400 | ||
| 404 | /* Likewise, but exclude the menu bar widget. */ | ||
| 405 | |||
| 406 | struct frame * | ||
| 407 | x_non_menubar_window_to_frame (dpyinfo, wdesc) | ||
| 408 | struct x_display_info *dpyinfo; | ||
| 409 | int wdesc; | ||
| 410 | { | ||
| 411 | Lisp_Object tail, frame; | ||
| 412 | struct frame *f; | ||
| 413 | struct x_output *x; | ||
| 414 | |||
| 415 | if (wdesc == None) return 0; | ||
| 416 | |||
| 417 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) | ||
| 418 | { | ||
| 419 | frame = XCAR (tail); | ||
| 420 | if (!FRAMEP (frame)) | ||
| 421 | continue; | ||
| 422 | f = XFRAME (frame); | ||
| 423 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | ||
| 424 | continue; | ||
| 425 | x = f->output_data.x; | ||
| 426 | /* This frame matches if the window is any of its widgets. */ | ||
| 427 | if (x->hourglass_window == wdesc) | ||
| 428 | return f; | ||
| 429 | else if (x->widget) | ||
| 430 | { | ||
| 431 | #ifdef USE_GTK | ||
| 432 | GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); | ||
| 433 | if (gwdesc != 0 | ||
| 434 | && (gwdesc == x->widget | ||
| 435 | || gwdesc == x->edit_widget | ||
| 436 | || gwdesc == x->vbox_widget)) | ||
| 437 | return f; | ||
| 438 | #else | ||
| 439 | if (wdesc == XtWindow (x->widget) | ||
| 440 | || wdesc == XtWindow (x->column_widget) | ||
| 441 | || wdesc == XtWindow (x->edit_widget)) | ||
| 442 | return f; | ||
| 443 | #endif | ||
| 444 | } | ||
| 445 | else if (FRAME_X_WINDOW (f) == wdesc) | ||
| 446 | /* A tooltip frame. */ | ||
| 447 | return f; | ||
| 448 | } | ||
| 449 | return 0; | ||
| 450 | } | ||
| 451 | |||
| 452 | /* Likewise, but consider only the menu bar widget. */ | 401 | /* Likewise, but consider only the menu bar widget. */ |
| 453 | 402 | ||
| 454 | struct frame * | 403 | struct frame * |
| @@ -476,15 +425,14 @@ x_menubar_window_to_frame (dpyinfo, wdesc) | |||
| 476 | if (x->menubar_widget) | 425 | if (x->menubar_widget) |
| 477 | { | 426 | { |
| 478 | GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); | 427 | GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); |
| 479 | int found = 0; | ||
| 480 | 428 | ||
| 481 | BLOCK_INPUT; | 429 | /* This gives false positives, but the rectangle check in xterm.c |
| 430 | where this is called takes care of that. */ | ||
| 482 | if (gwdesc != 0 | 431 | if (gwdesc != 0 |
| 483 | && (gwdesc == x->menubar_widget | 432 | && (gwdesc == x->menubar_widget |
| 484 | || gtk_widget_get_parent (gwdesc) == x->menubar_widget)) | 433 | || gtk_widget_is_ancestor (x->menubar_widget, gwdesc) |
| 485 | found = 1; | 434 | || gtk_widget_is_ancestor (gwdesc, x->menubar_widget))) |
| 486 | UNBLOCK_INPUT; | 435 | return f; |
| 487 | if (found) return f; | ||
| 488 | } | 436 | } |
| 489 | #else | 437 | #else |
| 490 | if (x->menubar_widget | 438 | if (x->menubar_widget |
diff --git a/src/xterm.c b/src/xterm.c index e536d0ddc25..1e13ae8858b 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -109,8 +109,6 @@ extern void xlwmenu_redisplay P_ ((Widget)); | |||
| 109 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 109 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 110 | 110 | ||
| 111 | extern void free_frame_menubar P_ ((struct frame *)); | 111 | extern void free_frame_menubar P_ ((struct frame *)); |
| 112 | extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, | ||
| 113 | int)); | ||
| 114 | #endif | 112 | #endif |
| 115 | 113 | ||
| 116 | #ifdef USE_X_TOOLKIT | 114 | #ifdef USE_X_TOOLKIT |
| @@ -143,11 +141,6 @@ extern void _XEditResCheckMessages (); | |||
| 143 | 141 | ||
| 144 | #endif /* USE_X_TOOLKIT */ | 142 | #endif /* USE_X_TOOLKIT */ |
| 145 | 143 | ||
| 146 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) | ||
| 147 | #define x_any_window_to_frame x_window_to_frame | ||
| 148 | #define x_top_window_to_frame x_window_to_frame | ||
| 149 | #endif | ||
| 150 | |||
| 151 | #ifdef USE_X_TOOLKIT | 144 | #ifdef USE_X_TOOLKIT |
| 152 | #include "widget.h" | 145 | #include "widget.h" |
| 153 | #ifndef XtNinitialState | 146 | #ifndef XtNinitialState |
| @@ -3908,7 +3901,14 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3908 | 3901 | ||
| 3909 | if (child == None || child == win) | 3902 | if (child == None || child == win) |
| 3910 | break; | 3903 | break; |
| 3911 | 3904 | #ifdef USE_GTK | |
| 3905 | /* We don't wan't to know the innermost window. We | ||
| 3906 | want the edit window. For non-Gtk+ the innermost | ||
| 3907 | window is the edit window. For Gtk+ it might not | ||
| 3908 | be. It might be the tool bar for example. */ | ||
| 3909 | if (x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win)) | ||
| 3910 | break; | ||
| 3911 | #endif | ||
| 3912 | win = child; | 3912 | win = child; |
| 3913 | parent_x = win_x; | 3913 | parent_x = win_x; |
| 3914 | parent_y = win_y; | 3914 | parent_y = win_y; |
| @@ -3925,8 +3925,14 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3925 | parent_{x,y} are invalid, but that's okay, because we'll | 3925 | parent_{x,y} are invalid, but that's okay, because we'll |
| 3926 | never use them in that case.) */ | 3926 | never use them in that case.) */ |
| 3927 | 3927 | ||
| 3928 | #ifdef USE_GTK | ||
| 3929 | /* We don't wan't to know the innermost window. We | ||
| 3930 | want the edit window. */ | ||
| 3931 | f1 = x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win); | ||
| 3932 | #else | ||
| 3928 | /* Is win one of our frames? */ | 3933 | /* Is win one of our frames? */ |
| 3929 | f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win); | 3934 | f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win); |
| 3935 | #endif | ||
| 3930 | 3936 | ||
| 3931 | #ifdef USE_X_TOOLKIT | 3937 | #ifdef USE_X_TOOLKIT |
| 3932 | /* If we end up with the menu bar window, say it's not | 3938 | /* If we end up with the menu bar window, say it's not |
diff --git a/src/xterm.h b/src/xterm.h index 0ab19fdd8dc..5e83ef87074 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -378,7 +378,7 @@ extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int)); | |||
| 378 | 378 | ||
| 379 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 379 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 380 | extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int)); | 380 | extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int)); |
| 381 | extern struct frame *x_non_menubar_window_to_frame P_ ((struct x_display_info *, int)); | 381 | extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, int)); |
| 382 | extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int)); | 382 | extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int)); |
| 383 | #endif | 383 | #endif |
| 384 | 384 | ||