summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-06-10 08:55:03 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-06-10 08:55:03 +0400
commitbfd559357dd906f4fe57b67346cf2bd8bdb8f2a3 (patch)
tree9eb702d4208c1b32de82269bf061b5d720cadb8f
parent24ce6a0214e7b885363990e07dabf2935a8c1e11 (diff)
downloademacs-bfd559357dd906f4fe57b67346cf2bd8bdb8f2a3.tar.gz
* dispextern.h (last_tool_bar_item): Remove declaration.
* frame.h (struct frame): New member last_tool_bar_item. * frame.c (make_frame): Initialize it. * xdisp.c (toplevel): Remove last_tool_bar_item. (handle_tool_bar_click, note_tool_bar_highlight): * w32term.c (w32_read_socket, w32_initialize): * xterm.c (handle_one_xevent, x_initialize): Adjust users.
-rw-r--r--src/ChangeLog8
-rw-r--r--src/dispextern.h1
-rw-r--r--src/frame.c3
-rw-r--r--src/frame.h5
-rw-r--r--src/w32term.c12
-rw-r--r--src/xdisp.c14
-rw-r--r--src/xterm.c8
7 files changed, 30 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e050baeb935..f15c0f5f798 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -14,6 +14,14 @@
* xftfont.c (xftfont_prepare_face): Likewise. Use xmalloc.
(xftfont_done_face): Use xfree.
+ * dispextern.h (last_tool_bar_item): Remove declaration.
+ * frame.h (struct frame): New member last_tool_bar_item.
+ * frame.c (make_frame): Initialize it.
+ * xdisp.c (toplevel): Remove last_tool_bar_item.
+ (handle_tool_bar_click, note_tool_bar_highlight):
+ * w32term.c (w32_read_socket, w32_initialize):
+ * xterm.c (handle_one_xevent, x_initialize): Adjust users.
+
2014-06-09 Paul Eggert <eggert@cs.ucla.edu>
Say (accept-process-output P)'s result pertains to P if P is non-nil.
diff --git a/src/dispextern.h b/src/dispextern.h
index 21ed5f70ad2..e710f8e35d7 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3194,7 +3194,6 @@ extern bool help_echo_showing_p;
extern Lisp_Object help_echo_string, help_echo_window;
extern Lisp_Object help_echo_object, previous_help_echo_string;
extern ptrdiff_t help_echo_pos;
-extern int last_tool_bar_item;
extern void reseat_at_previous_visible_line_start (struct it *);
extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
extern ptrdiff_t compute_display_string_pos (struct text_pos *,
diff --git a/src/frame.c b/src/frame.c
index e75a74be938..9d820819623 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -352,6 +352,9 @@ make_frame (bool mini_p)
f->line_height = 1; /* !FRAME_WINDOW_P value. */
#ifdef HAVE_WINDOW_SYSTEM
f->want_fullscreen = FULLSCREEN_NONE;
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+ f->last_tool_bar_item = -1;
+#endif
#endif
root_window = make_window ();
diff --git a/src/frame.h b/src/frame.h
index 0ee97f0b3f3..a962e91ce2d 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -164,6 +164,11 @@ struct frame
/* Cache of realized faces. */
struct face_cache *face_cache;
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+ /* Tool-bar item index of the item on which a mouse button was pressed. */
+ int last_tool_bar_item;
+#endif
+
/* Number of elements in `menu_bar_vector' that have meaningful data. */
int menu_bar_items_used;
diff --git a/src/w32term.c b/src/w32term.c
index fc45bdd30a3..553764a8de5 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4536,10 +4536,11 @@ w32_read_socket (struct terminal *terminal,
Emacs events should reflect only motion after
the ButtonPress. */
if (f != 0)
- f->mouse_moved = 0;
-
- if (!tool_bar_p)
- last_tool_bar_item = -1;
+ {
+ f->mouse_moved = 0;
+ if (!tool_bar_p)
+ f->last_tool_bar_item = -1;
+ }
}
break;
}
@@ -4564,9 +4565,9 @@ w32_read_socket (struct terminal *terminal,
should reflect only motion after the
ButtonPress. */
f->mouse_moved = 0;
+ f->last_tool_bar_item = -1;
}
dpyinfo->last_mouse_frame = f;
- last_tool_bar_item = -1;
}
break;
@@ -6454,7 +6455,6 @@ w32_initialize (void)
&w32_use_visible_system_caret, 0))
w32_use_visible_system_caret = 0;
- last_tool_bar_item = -1;
any_help_event_p = 0;
/* Initialize input mode: interrupt_input off, no flow control, allow
diff --git a/src/xdisp.c b/src/xdisp.c
index 71398b833e8..c592e0c3116 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11806,11 +11806,6 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
#ifdef HAVE_WINDOW_SYSTEM
-/* Tool-bar item index of the item on which a mouse button was pressed
- or -1. */
-
-int last_tool_bar_item;
-
/* Select `frame' temporarily without running all the code in
do_switch_frame.
FIXME: Maybe do_switch_frame should be trimmed down similarly
@@ -12612,7 +12607,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
where the button was pressed, disregarding where it was
released. */
if (NILP (Vmouse_highlight) && !down_p)
- prop_idx = last_tool_bar_item;
+ prop_idx = f->last_tool_bar_item;
/* If item is disabled, do nothing. */
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P);
@@ -12624,7 +12619,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
/* Show item in pressed state. */
if (!NILP (Vmouse_highlight))
show_mouse_face (hlinfo, DRAW_IMAGE_SUNKEN);
- last_tool_bar_item = prop_idx;
+ f->last_tool_bar_item = prop_idx;
}
else
{
@@ -12649,7 +12644,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
event.arg = key;
event.modifiers = modifiers;
kbd_buffer_store_event (&event);
- last_tool_bar_item = -1;
+ f->last_tool_bar_item = -1;
}
}
@@ -12699,8 +12694,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
mouse_down_p = (x_mouse_grabbed (dpyinfo)
&& f == dpyinfo->last_mouse_frame);
- if (mouse_down_p
- && last_tool_bar_item != prop_idx)
+ if (mouse_down_p && f->last_tool_bar_item != prop_idx)
return;
draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
diff --git a/src/xterm.c b/src/xterm.c
index 422800f3765..b6728880f5d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6809,9 +6809,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
{
dpyinfo->grabbed |= (1 << event->xbutton.button);
dpyinfo->last_mouse_frame = f;
-
- if (!tool_bar_p)
- last_tool_bar_item = -1;
+#if ! defined (USE_GTK)
+ if (f && !tool_bar_p)
+ f->last_tool_bar_item = -1;
+#endif /* not USE_GTK */
}
else
dpyinfo->grabbed &= ~(1 << event->xbutton.button);
@@ -10555,7 +10556,6 @@ x_initialize (void)
baud_rate = 19200;
x_noop_count = 0;
- last_tool_bar_item = -1;
any_help_event_p = 0;
ignore_next_mouse_click_timeout = 0;