aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-11-12 08:00:55 +0400
committerDmitry Antipov2012-11-12 08:00:55 +0400
commit5b04e9f9ac3212f0eb88c853dd21dd63a8bdbee2 (patch)
treed9449b2bda744e962e336625f60c5c004e5c721e /src/xterm.c
parent31f47fbaead299941c22a133ed7e2928c7b1273e (diff)
downloademacs-5b04e9f9ac3212f0eb88c853dd21dd63a8bdbee2.tar.gz
emacs-5b04e9f9ac3212f0eb88c853dd21dd63a8bdbee2.zip
Simplify by using FOR_EACH_FRAME here and there.
* frame.c (next_frame, prev_frame, other_visible_frames) (delete_frame, visible-frame-list): Use FOR_EACH_FRAME. * w32term.c (x_window_to_scroll_bar): Likewise. * window.c (window_list): Likewise. * xdisp.c (x_consider_frame_title): Likewise. * xfaces.c ( Fdisplay_supports_face_attributes_p): Likewise. * xfns.c (x_window_to_frame, x_any_window_to_frame) (x_menubar_window_to_frame, x_top_window_to_frame): Likewise. * xmenu.c (menubar_id_to_frame): Likewise. * xselect.c (frame_for_x_selection): Likewise. * xterm.c (x_frame_of_widget, x_window_to_scroll_bar) (x_window_to_menu_bar): Likewise. * w32fns.c (x_window_to_frame): Likewise. Adjust comment.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c51
1 files changed, 21 insertions, 30 deletions
diff --git a/src/xterm.c b/src/xterm.c
index f89fbabaecc..463d82b4ee2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1438,7 +1438,7 @@ static struct frame *
1438x_frame_of_widget (Widget widget) 1438x_frame_of_widget (Widget widget)
1439{ 1439{
1440 struct x_display_info *dpyinfo; 1440 struct x_display_info *dpyinfo;
1441 Lisp_Object tail; 1441 Lisp_Object tail, frame;
1442 struct frame *f; 1442 struct frame *f;
1443 1443
1444 dpyinfo = x_display_info_for_display (XtDisplay (widget)); 1444 dpyinfo = x_display_info_for_display (XtDisplay (widget));
@@ -1452,15 +1452,15 @@ x_frame_of_widget (Widget widget)
1452 1452
1453 /* Look for a frame with that top-level widget. Allocate the color 1453 /* Look for a frame with that top-level widget. Allocate the color
1454 on that frame to get the right gamma correction value. */ 1454 on that frame to get the right gamma correction value. */
1455 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) 1455 FOR_EACH_FRAME (tail, frame)
1456 if (FRAMEP (XCAR (tail)) 1456 {
1457 && (f = XFRAME (XCAR (tail)), 1457 f = XFRAME (frame);
1458 (FRAME_X_P (f) 1458 if (FRAME_X_P (f)
1459 && f->output_data.nothing != 1 1459 && f->output_data.nothing != 1
1460 && FRAME_X_DISPLAY_INFO (f) == dpyinfo)) 1460 && FRAME_X_DISPLAY_INFO (f) == dpyinfo
1461 && f->output_data.x->widget == widget) 1461 && f->output_data.x->widget == widget)
1462 return f; 1462 return f;
1463 1463 }
1464 emacs_abort (); 1464 emacs_abort ();
1465} 1465}
1466 1466
@@ -4098,20 +4098,15 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
4098static struct scroll_bar * 4098static struct scroll_bar *
4099x_window_to_scroll_bar (Display *display, Window window_id) 4099x_window_to_scroll_bar (Display *display, Window window_id)
4100{ 4100{
4101 Lisp_Object tail; 4101 Lisp_Object tail, frame;
4102 4102
4103#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS) 4103#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
4104 window_id = (Window) xg_get_scroll_id_for_window (display, window_id); 4104 window_id = (Window) xg_get_scroll_id_for_window (display, window_id);
4105#endif /* USE_GTK && USE_TOOLKIT_SCROLL_BARS */ 4105#endif /* USE_GTK && USE_TOOLKIT_SCROLL_BARS */
4106 4106
4107 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) 4107 FOR_EACH_FRAME (tail, frame)
4108 { 4108 {
4109 Lisp_Object frame, bar, condemned; 4109 Lisp_Object bar, condemned;
4110
4111 frame = XCAR (tail);
4112 /* All elements of Vframe_list should be frames. */
4113 if (! FRAMEP (frame))
4114 emacs_abort ();
4115 4110
4116 if (! FRAME_X_P (XFRAME (frame))) 4111 if (! FRAME_X_P (XFRAME (frame)))
4117 continue; 4112 continue;
@@ -4143,20 +4138,16 @@ x_window_to_scroll_bar (Display *display, Window window_id)
4143static Widget 4138static Widget
4144x_window_to_menu_bar (Window window) 4139x_window_to_menu_bar (Window window)
4145{ 4140{
4146 Lisp_Object tail; 4141 Lisp_Object tail, frame;
4147 4142
4148 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) 4143 FOR_EACH_FRAME (tail, frame)
4149 { 4144 if (FRAME_X_P (XFRAME (frame)))
4150 if (FRAME_X_P (XFRAME (XCAR (tail)))) 4145 {
4151 { 4146 Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget;
4152 Lisp_Object frame = XCAR (tail);
4153 Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget;
4154
4155 if (menu_bar && xlwmenu_window_p (menu_bar, window))
4156 return menu_bar;
4157 }
4158 }
4159 4147
4148 if (menu_bar && xlwmenu_window_p (menu_bar, window))
4149 return menu_bar;
4150 }
4160 return NULL; 4151 return NULL;
4161} 4152}
4162 4153