From da9541dd1086b7bab52940c82915efe114bb7419 Mon Sep 17 00:00:00 2001 From: Alexander Gramiak Date: Thu, 11 Apr 2019 09:00:58 -0600 Subject: [PATCH] Add prefixes to some window system-dependent procedures * src/nsterm.m (note_mouse_movement): * src/w32fns.c (construct_console_modifiers): * src/w32inevt.c: * src/w32term.c (frame_highlight, frame_unhighlight) (construct_mouse_click, construct_mouse_wheel, construct_drag_n_drop) (lispy_file_action, queue_notifications, note_mouse_movement): * src/w32term.h: * src/xterm.c (frame_highlight, frame_unhighlight) (construct_mouse_click, note_mouse_movement, get_current_wm_state): Add and use window system prefixes. --- src/nsterm.m | 6 +++--- src/w32fns.c | 8 ++++---- src/w32inevt.c | 2 +- src/w32term.c | 43 +++++++++++++++++++++++-------------------- src/w32term.h | 2 +- src/xterm.c | 42 +++++++++++++++++++++--------------------- 6 files changed, 53 insertions(+), 50 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 15316e23edc..62fb4b2e216 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2467,7 +2467,7 @@ frame_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) } static int -note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) +ns_note_mouse_movement (struct frame *frame, CGFloat x, CGFloat y) /* ------------------------------------------------------------------------ Called by EmacsView on mouseMovement events. Passes on to emacs mainstream code if we moved off of a rect of interest @@ -6890,7 +6890,7 @@ not_in_argv (NSString *arg) last_mouse_window = window; } - if (!note_mouse_movement (emacsframe, pt.x, pt.y)) + if (!ns_note_mouse_movement (emacsframe, pt.x, pt.y)) help_echo_string = previous_help_echo_string; XSETFRAME (frame, emacsframe); @@ -6898,7 +6898,7 @@ not_in_argv (NSString *arg) { /* NOTE: help_echo_{window,pos,object} are set in xdisp.c (note_mouse_highlight), which is called through the - note_mouse_movement () call above. */ + ns_note_mouse_movement () call above. */ any_help_event_p = YES; gen_help_event (help_echo_string, frame, help_echo_window, help_echo_object, help_echo_pos); diff --git a/src/w32fns.c b/src/w32fns.c index 814998f5f2f..e6cb1ee311c 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3061,7 +3061,7 @@ w32_get_modifiers (void) and window input. */ static int -construct_console_modifiers (void) +w32_construct_console_modifiers (void) { int mods; @@ -3087,7 +3087,7 @@ w32_get_key_modifiers (unsigned int wparam, unsigned int lparam) int mods; /* Convert to emacs modifiers. */ - mods = w32_kbd_mods_to_emacs (construct_console_modifiers (), wparam); + mods = w32_kbd_mods_to_emacs (w32_construct_console_modifiers (), wparam); return mods; } @@ -3719,7 +3719,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, if (count) { W32Msg wmsg; - DWORD console_modifiers = construct_console_modifiers (); + DWORD console_modifiers = w32_construct_console_modifiers (); int *b = buf, strip_ExtraMods = 1, hairy = 0; const char *type_CtrlAlt = NULL; @@ -4351,7 +4351,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* If not defined as a function key, change it to a WM_CHAR message. */ if (wParam > 255 || !lispy_function_keys[wParam]) { - DWORD modifiers = construct_console_modifiers (); + DWORD modifiers = w32_construct_console_modifiers (); if (!NILP (Vw32_recognize_altgr) && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU)) diff --git a/src/w32inevt.c b/src/w32inevt.c index ab71c560d69..fc1f90cd025 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -680,7 +680,7 @@ handle_file_notifications (struct input_event *hold_quit) already be defined at this point. */ Lisp_Object fname = code_convert_string_norecord (utf_16_fn, cs, 0); - Lisp_Object action = lispy_file_action (fni->Action); + Lisp_Object action = w32_lispy_file_action (fni->Action); inev.kind = FILE_NOTIFY_EVENT; inev.timestamp = GetTickCount (); diff --git a/src/w32term.c b/src/w32term.c index a43d43c5583..edcdc56a9ea 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -180,8 +180,8 @@ static void w32_initialize (void); static void x_update_end (struct frame *); static void w32_frame_up_to_date (struct frame *); static void x_clear_frame (struct frame *); -static void frame_highlight (struct frame *); -static void frame_unhighlight (struct frame *); +static void w32_frame_highlight (struct frame *); +static void w32_frame_unhighlight (struct frame *); static void x_new_focus_frame (struct w32_display_info *, struct frame *); static void x_focus_changed (int, int, struct w32_display_info *, @@ -2904,14 +2904,14 @@ x_scroll_run (struct window *w, struct run *run) ***********************************************************************/ static void -frame_highlight (struct frame *f) +w32_frame_highlight (struct frame *f) { gui_update_cursor (f, 1); x_set_frame_alpha (f); } static void -frame_unhighlight (struct frame *f) +w32_frame_unhighlight (struct frame *f) { gui_update_cursor (f, 1); x_set_frame_alpha (f); @@ -3059,9 +3059,9 @@ x_frame_rehighlight (struct w32_display_info *dpyinfo) if (dpyinfo->x_highlight_frame != old_highlight) { if (old_highlight) - frame_unhighlight (old_highlight); + w32_frame_unhighlight (old_highlight); if (dpyinfo->x_highlight_frame) - frame_highlight (dpyinfo->x_highlight_frame); + w32_frame_highlight (dpyinfo->x_highlight_frame); } } @@ -3168,7 +3168,8 @@ parse_button (int message, int xbutton, int * pbutton, int * pup) the mouse. */ static Lisp_Object -construct_mouse_click (struct input_event *result, W32Msg *msg, struct frame *f) +w32_construct_mouse_click (struct input_event *result, W32Msg *msg, + struct frame *f) { int button = 0; int up = 0; @@ -3194,7 +3195,8 @@ construct_mouse_click (struct input_event *result, W32Msg *msg, struct frame *f) } static Lisp_Object -construct_mouse_wheel (struct input_event *result, W32Msg *msg, struct frame *f) +w32_construct_mouse_wheel (struct input_event *result, W32Msg *msg, + struct frame *f) { POINT p; int delta; @@ -3228,7 +3230,8 @@ construct_mouse_wheel (struct input_event *result, W32Msg *msg, struct frame *f) } static Lisp_Object -construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) +w32_construct_drag_n_drop (struct input_event *result, W32Msg *msg, + struct frame *f) { Lisp_Object files; Lisp_Object frame; @@ -3307,7 +3310,7 @@ construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) /* File event notifications (see w32notify.c). */ Lisp_Object -lispy_file_action (DWORD action) +w32_lispy_file_action (DWORD action) { static char unknown_fmt[] = "unknown-action(%d)"; Lisp_Object retval; @@ -3347,8 +3350,8 @@ lispy_file_action (DWORD action) function runs when the WM_EMACS_FILENOTIFY message arrives from a watcher thread. */ static void -queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, - int *evcount) +w32_queue_notifications (struct input_event *event, W32Msg *msg, + struct frame *f, int *evcount) { struct notifications_set *ns = NULL; Lisp_Object frame; @@ -3407,7 +3410,7 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, already be defined at this point. */ Lisp_Object fname = code_convert_string_norecord (utf_16_fn, cs, 0); - Lisp_Object action = lispy_file_action (fni->Action); + Lisp_Object action = w32_lispy_file_action (fni->Action); event->kind = FILE_NOTIFY_EVENT; event->timestamp = msg->msg.time; @@ -3445,7 +3448,7 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, another motion event, so we can check again the next time it moves. */ static int -note_mouse_movement (struct frame *frame, MSG *msg) +w32_note_mouse_movement (struct frame *frame, MSG *msg) { struct w32_display_info *dpyinfo; int mouse_x = LOWORD (msg->lParam); @@ -5020,7 +5023,7 @@ w32_read_socket (struct terminal *terminal, last_mouse_window = window; } - if (!note_mouse_movement (f, &msg.msg)) + if (!w32_note_mouse_movement (f, &msg.msg)) help_echo_string = previous_help_echo_string; } else @@ -5064,7 +5067,7 @@ w32_read_socket (struct terminal *terminal, if (f) { - construct_mouse_click (&inev, &msg, f); + w32_construct_mouse_click (&inev, &msg, f); /* Is this in the tool-bar? */ if (WINDOWP (f->tool_bar_window) @@ -5129,7 +5132,7 @@ w32_read_socket (struct terminal *terminal, || f == dpyinfo->w32_focus_frame) /* Emit an Emacs wheel-up/down event. */ { - construct_mouse_wheel (&inev, &msg, f); + w32_construct_mouse_wheel (&inev, &msg, f); /* Ignore any mouse motion that happened before this event; any subsequent mouse-movement Emacs events @@ -5146,7 +5149,7 @@ w32_read_socket (struct terminal *terminal, if (f1 && FRAME_LIVE_P (f1) && FRAME_W32_P (f1)) { - construct_mouse_wheel (&inev, &msg, f1); + w32_construct_mouse_wheel (&inev, &msg, f1); f1->mouse_moved = false; f1->last_tool_bar_item = -1; dpyinfo->last_mouse_frame = f1; @@ -5166,7 +5169,7 @@ w32_read_socket (struct terminal *terminal, f = x_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) - construct_drag_n_drop (&inev, &msg, f); + w32_construct_drag_n_drop (&inev, &msg, f); break; case WM_HSCROLL: @@ -5577,7 +5580,7 @@ w32_read_socket (struct terminal *terminal, case WM_EMACS_FILENOTIFY: f = x_window_to_frame (dpyinfo, msg.msg.hwnd); if (f) - queue_notifications (&inev, &msg, f, &count); + w32_queue_notifications (&inev, &msg, f, &count); break; #endif diff --git a/src/w32term.h b/src/w32term.h index 4c496e97e4a..a0942d630a5 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -732,7 +732,7 @@ struct notifications_set { }; extern struct notifications_set *notifications_set_head; extern Lisp_Object w32_get_watch_object (void *); -extern Lisp_Object lispy_file_action (DWORD); +extern Lisp_Object w32_lispy_file_action (DWORD); extern int handle_file_notifications (struct input_event *); extern void w32_initialize_display_info (Lisp_Object); diff --git a/src/xterm.c b/src/xterm.c index 5d4d2ca3b78..69f9afddbcc 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -234,7 +234,7 @@ static void x_wm_set_window_state (struct frame *, int); static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t); static void x_initialize (void); -static bool get_current_wm_state (struct frame *, Window, int *, bool *); +static bool x_get_current_wm_state (struct frame *, Window, int *, bool *); /* Flush display of frame F. */ @@ -4354,7 +4354,7 @@ x_scroll_run (struct window *w, struct run *run) static void -frame_highlight (struct frame *f) +x_frame_highlight (struct frame *f) { /* We used to only do this if Vx_no_window_manager was non-nil, but the ICCCM (section 4.1.6) says that the window's border pixmap @@ -4375,7 +4375,7 @@ frame_highlight (struct frame *f) } static void -frame_unhighlight (struct frame *f) +x_frame_unhighlight (struct frame *f) { /* We used to only do this if Vx_no_window_manager was non-nil, but the ICCCM (section 4.1.6) says that the window's border pixmap @@ -4740,9 +4740,9 @@ x_frame_rehighlight (struct x_display_info *dpyinfo) if (dpyinfo->x_highlight_frame != old_highlight) { if (old_highlight) - frame_unhighlight (old_highlight); + x_frame_unhighlight (old_highlight); if (dpyinfo->x_highlight_frame) - frame_highlight (dpyinfo->x_highlight_frame); + x_frame_highlight (dpyinfo->x_highlight_frame); } } @@ -4962,9 +4962,9 @@ x_get_keysym_name (int keysym) the mouse. */ static Lisp_Object -construct_mouse_click (struct input_event *result, - const XButtonEvent *event, - struct frame *f) +x_construct_mouse_click (struct input_event *result, + const XButtonEvent *event, + struct frame *f) { /* Make the event type NO_EVENT; we'll change that when we decide otherwise. */ @@ -4993,7 +4993,7 @@ construct_mouse_click (struct input_event *result, another motion event, so we can check again the next time it moves. */ static bool -note_mouse_movement (struct frame *frame, const XMotionEvent *event) +x_note_mouse_movement (struct frame *frame, const XMotionEvent *event) { XRectangle *r; struct x_display_info *dpyinfo; @@ -7670,7 +7670,7 @@ x_net_wm_state (struct frame *f, Window window) Lisp_Object lval = Qnil; bool sticky = false; - get_current_wm_state (f, window, &value, &sticky); + x_get_current_wm_state (f, window, &value, &sticky); switch (value) { @@ -8594,12 +8594,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, /* EnterNotify counts as mouse movement, so update things that depend on mouse position. */ if (f && !f->output_data.x->hourglass_p) - note_mouse_movement (f, &event->xmotion); + x_note_mouse_movement (f, &event->xmotion); #ifdef USE_GTK /* We may get an EnterNotify on the buttons in the toolbar. In that case we moved out of any highlighted area and need to note this. */ if (!f && dpyinfo->last_mouse_glyph_frame) - note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); + x_note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); #endif goto OTHER; @@ -8632,7 +8632,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef USE_GTK /* See comment in EnterNotify above */ else if (dpyinfo->last_mouse_glyph_frame) - note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); + x_note_mouse_movement (dpyinfo->last_mouse_glyph_frame, &event->xmotion); #endif goto OTHER; @@ -8701,7 +8701,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, last_mouse_window = window; } - if (!note_mouse_movement (f, &event->xmotion)) + if (!x_note_mouse_movement (f, &event->xmotion)) help_echo_string = previous_help_echo_string; } else @@ -8959,13 +8959,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, && event->xbutton.time > ignore_next_mouse_click_timeout) { ignore_next_mouse_click_timeout = 0; - construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, f); } if (event->type == ButtonRelease) ignore_next_mouse_click_timeout = 0; } else - construct_mouse_click (&inev.ie, &event->xbutton, f); + x_construct_mouse_click (&inev.ie, &event->xbutton, f); } if (FRAME_X_EMBEDDED_P (f)) xembed_send_message (f, event->xbutton.time, @@ -10671,10 +10671,10 @@ x_set_z_group (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) Return true iff we are not hidden. */ static bool -get_current_wm_state (struct frame *f, - Window window, - int *size_state, - bool *sticky) +x_get_current_wm_state (struct frame *f, + Window window, + int *size_state, + bool *sticky) { unsigned long actual_size; int i; @@ -10922,7 +10922,7 @@ x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) int value = FULLSCREEN_NONE; Lisp_Object lval; bool sticky = false; - bool not_hidden = get_current_wm_state (f, event->window, &value, &sticky); + bool not_hidden = x_get_current_wm_state (f, event->window, &value, &sticky); lval = Qnil; switch (value) -- 2.39.2