From fcd42c11c0e0e5fa3ab931ad2126b1d855ba240f Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 13 Sep 2013 20:46:18 +0400 Subject: [PATCH] Unify Fx_focus_frame between all ports. * src/frame.h (x_focus_frame): New prototype. * src/xfns.c (Fx_focus_frame): Remove. (syms_of_xfns): Do not defsubr it. (x_focus_frame): X implementation. * src/nsfns.m (Fx_focus_frame): Remove. (syms_of_nsfns): Do not defsubr it. (x_focus_frame): NS implementation. * src/w32term.c (Fx_focus_frame): Remove. (x_focus_on_frame): Rename to... (x_focus_frame): W32 implementation. * src/w32term.h (x_focus_on_frame): Remove prototype. * src/w32fns.c (Fx_focus_frame): Remove. (syms_of_w32fns): Do not defsubr it. * src/frame.c (Fx_focus_frame): Define here. (syms_of_frame): Defsubr here. * src/gtkutil.c (xg_tool_bar_callback): Use x_focus_frame. * lisp/frame.el (x-focus-frame): Mark as declared in frame.c. --- lisp/ChangeLog | 4 ++++ lisp/frame.el | 2 +- src/ChangeLog | 20 ++++++++++++++++++++ src/frame.c | 9 +++++++++ src/frame.h | 1 + src/gtkutil.c | 6 +++--- src/nsfns.m | 11 ++--------- src/w32fns.c | 10 ---------- src/w32term.c | 2 +- src/w32term.h | 2 -- src/xfns.c | 10 ++-------- 11 files changed, 43 insertions(+), 34 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 649e3a3b01..aa17b9328c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-09-13 Dmitry Antipov + + * frame.el (x-focus-frame): Mark as declared in frame.c. + 2013-09-13 Stefan Monnier * ls-lisp.el: Use advice-add. diff --git a/lisp/frame.el b/lisp/frame.el index 3668f24ba0..74149a8dc0 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -759,7 +759,7 @@ the user during startup." (nreverse frame-initial-geometry-arguments)) (cdr param-list)) -(declare-function x-focus-frame "xfns.c" (frame)) +(declare-function x-focus-frame "frame.c" (frame)) (defun select-frame-set-input-focus (frame &optional norecord) "Select FRAME, raise it, and set input focus, if possible. diff --git a/src/ChangeLog b/src/ChangeLog index 57cb776038..cc8704da2a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2013-09-13 Dmitry Antipov + + Unify Fx_focus_frame between all ports. + * frame.h (x_focus_frame): New prototype. + * xfns.c (Fx_focus_frame): Remove. + (syms_of_xfns): Do not defsubr it. + (x_focus_frame): X implementation. + * nsfns.m (Fx_focus_frame): Remove. + (syms_of_nsfns): Do not defsubr it. + (x_focus_frame): NS implementation. + * w32term.c (Fx_focus_frame): Remove. + (x_focus_on_frame): Rename to... + (x_focus_frame): W32 implementation. + * w32term.h (x_focus_on_frame): Remove prototype. + * w32fns.c (Fx_focus_frame): Remove. + (syms_of_w32fns): Do not defsubr it. + * frame.c (Fx_focus_frame): Define here. + (syms_of_frame): Defsubr here. + * gtkutil.c (xg_tool_bar_callback): Use x_focus_frame. + 2013-09-13 Dmitry Antipov Unify FRAME_window_system_DISPLAY_INFO macros between all ports. diff --git a/src/frame.c b/src/frame.c index 0de3152166..74e57f9b5f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1901,6 +1901,14 @@ See `redirect-frame-focus'. */) return FRAME_FOCUS_FRAME (decode_live_frame (frame)); } +DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, + doc: /* Set the input focus to FRAME. +FRAME nil means use the selected frame. */) + (Lisp_Object frame) +{ + x_focus_frame (decode_window_system_frame (frame)); + return Qnil; +} /* Return the value of frame parameter PROP in frame FRAME. */ @@ -4524,6 +4532,7 @@ automatically. See also `mouse-autoselect-window'. */); defsubr (&Svisible_frame_list); defsubr (&Sraise_frame); defsubr (&Slower_frame); + defsubr (&Sx_focus_frame); defsubr (&Sredirect_frame_focus); defsubr (&Sframe_focus); defsubr (&Sframe_parameters); diff --git a/src/frame.h b/src/frame.h index 4184ce24a1..ea550f4a2f 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1263,6 +1263,7 @@ extern void x_sync (struct frame *); extern void x_query_colors (struct frame *f, XColor *, int); extern void x_query_color (struct frame *f, XColor *); +extern void x_focus_frame (struct frame *); #endif /* HAVE_WINDOW_SYSTEM */ diff --git a/src/gtkutil.c b/src/gtkutil.c index 064145282b..95154ef9b5 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -3975,9 +3975,9 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) event.modifiers = x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), mod); kbd_buffer_store_event (&event); - /* Return focus to the frame after we have clicked on a detached - tool bar button. */ - Fx_focus_frame (frame); + /* Return focus to the frame after we have clicked on a detached + tool bar button. */ + x_focus_frame (f); } /* Callback function invoked when a tool bar item is pressed in a detached diff --git a/src/nsfns.m b/src/nsfns.m index 2d828991ff..8eaf529ed0 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1339,13 +1339,9 @@ This function is an internal primitive--use `make-frame' instead. */) return unbind_to (count, frame); } - -DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, - doc: /* Set the input focus to FRAME. -FRAME nil means use the selected frame. */) - (Lisp_Object frame) +void +x_focus_frame (struct frame *f) { - struct frame *f = decode_window_system_frame (frame); struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); if (dpyinfo->x_focus_frame != f) @@ -1356,8 +1352,6 @@ FRAME nil means use the selected frame. */) [[view window] makeKeyAndOrderFront: view]; unblock_input (); } - - return Qnil; } @@ -2894,7 +2888,6 @@ be used as the image of the icon representing the frame. */); defsubr (&Sns_list_services); defsubr (&Sns_perform_service); defsubr (&Sns_convert_utf8_nfd_to_nfc); - defsubr (&Sx_focus_frame); defsubr (&Sns_popup_font_panel); defsubr (&Sns_popup_color_panel); diff --git a/src/w32fns.c b/src/w32fns.c index d2defeed52..0e8b8ab5a5 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4622,15 +4622,6 @@ x_get_focus_frame (struct frame *frame) return xfocus; } -DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, - doc: /* Give FRAME input focus, raising to foreground if necessary. */) - (Lisp_Object frame) -{ - x_focus_on_frame (decode_window_system_frame (frame)); - return Qnil; -} - - DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, doc: /* Internal function called by `color-defined-p', which see. \(Note that the Nextstep version of this function ignores FRAME.) */) @@ -7857,7 +7848,6 @@ only be necessary if the default setting causes problems. */); defsubr (&Sx_close_connection); defsubr (&Sx_display_list); defsubr (&Sx_synchronize); - defsubr (&Sx_focus_frame); /* W32 specific functions */ diff --git a/src/w32term.c b/src/w32term.c index f86f7d351a..cb7327b21b 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -5806,7 +5806,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) /* focus shifting, raising and lowering. */ void -x_focus_on_frame (struct frame *f) +x_focus_frame (struct frame *f) { struct w32_display_info *dpyinfo = &one_w32_display_info; diff --git a/src/w32term.h b/src/w32term.h index 68c0245acb..5146fa8ef3 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -199,8 +199,6 @@ Lisp_Object display_x_get_resource (struct w32_display_info *, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); -extern void x_focus_on_frame (struct frame *f); - /* also defined in xterm.h XXX: factor out to common header */ extern struct w32_display_info *w32_term_init (Lisp_Object, diff --git a/src/xfns.c b/src/xfns.c index df5f0a742d..ecd1ce7bc9 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3252,12 +3252,9 @@ x_get_focus_frame (struct frame *frame) policy. But I think it's okay to use when it's clearly done following a user-command. */ -DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, - doc: /* Set the input focus to FRAME. -FRAME nil means use the selected frame. */) - (Lisp_Object frame) +void +x_focus_frame (struct frame *f) { - struct frame *f = decode_window_system_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); block_input (); @@ -3279,8 +3276,6 @@ FRAME nil means use the selected frame. */) x_uncatch_errors (); unblock_input (); - - return Qnil; } @@ -6170,7 +6165,6 @@ When using Gtk+ tooltips, the tooltip face is not used. */); defsubr (&Sx_close_connection); defsubr (&Sx_display_list); defsubr (&Sx_synchronize); - defsubr (&Sx_focus_frame); defsubr (&Sx_backspace_delete_keys_p); defsubr (&Sx_show_tip); -- 2.39.2