bool mouse_down_p = false;
#ifndef HAVE_NS
- /* Mouse is down, but on different tab-bar item? */
+ /* Mouse is down, but on different tab-bar item? Or alternatively,
+ the mouse might've been pressed somewhere we don't know about,
+ and then have moved onto the tab bar. In this case,
+ last_tab_bar_item is -1, so we DTRT and behave like other
+ programs by displaying the item as sunken. */
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
mouse_down_p = (gui_mouse_grabbed (dpyinfo)
&& f == dpyinfo->last_mouse_frame);
- if (mouse_down_p && f->last_tab_bar_item != prop_idx)
+ if (mouse_down_p && f->last_tab_bar_item != prop_idx
+ && f->last_tab_bar_item != -1)
return;
#endif
draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;