#ifdef USE_MOTIF
- /* We use an estimate of 30 chars per line rather than the real
- `portion' value. This has the disadvantage that the thumb size
- is not very representative, but it makes our life a lot easier.
- Otherwise, we have to constantly adjust the thumb size, which
- we can't always do quickly enough: while dragging, the size of
- the thumb might prevent the user from dragging the thumb all the
- way to the end. but Motif and some versions of Xaw3d don't allow
- updating the thumb size while dragging. Also, even if we can update
- its size, the update will often happen too late.
- If you don't believe it, check out revision 1.650 of xterm.c to see
- what hoops we were going through and the still poor behavior we got. */
- portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30;
- /* When the thumb is at the bottom, position == whole.
- So we need to increase `whole' to make space for the thumb. */
- whole += portion;
+ if (scroll_bar_adjust_thumb_portion_p)
+ {
+ /* We use an estimate of 30 chars per line rather than the real
+ `portion' value. This has the disadvantage that the thumb size
+ is not very representative, but it makes our life a lot easier.
+ Otherwise, we have to constantly adjust the thumb size, which
+ we can't always do quickly enough: while dragging, the size of
+ the thumb might prevent the user from dragging the thumb all the
+ way to the end. but Motif and some versions of Xaw3d don't allow
+ updating the thumb size while dragging. Also, even if we can update
+ its size, the update will often happen too late.
+ If you don't believe it, check out revision 1.650 of xterm.c to see
+ what hoops we were going through and the still poor behavior we got. */
+ portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30;
+ /* When the thumb is at the bottom, position == whole.
+ So we need to increase `whole' to make space for the thumb. */
+ whole += portion;
+ }
if (whole <= 0)
top = 0, shown = 1;
last_user_time = event.xproperty.time;
f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
- if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified
- && f->output_data.x->net_wm_state_hidden_seen)
+ if (x_handle_net_wm_state (f, &event.xproperty)
+ && FRAME_ICONIFIED_P (f)
+ && f->output_data.x->net_wm_state_hidden_seen)
{
- /* Gnome shell does not iconify us when C-z is pressed. It hides
- the frame. So if our state says we aren't hidden anymore,
- treat it as deiconified. */
- if (! f->async_iconified)
- SET_FRAME_GARBAGED (f);
- f->async_visible = 1;
- f->async_iconified = 0;
+ /* Gnome shell does not iconify us when C-z is pressed.
+ It hides the frame. So if our state says we aren't
+ hidden anymore, treat it as deiconified. */
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
f->output_data.x->has_been_visible = 1;
f->output_data.x->net_wm_state_hidden_seen = 0;
inev.ie.kind = DEICONIFY_EVENT;
event.xexpose.width, event.xexpose.height,
FALSE);
#endif
- if (f->async_visible == 0)
+ if (!FRAME_VISIBLE_P (f))
{
- f->async_visible = 1;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
f->output_data.x->has_been_visible = 1;
SET_FRAME_GARBAGED (f);
}
if (f) /* F may no longer exist if
the frame was deleted. */
{
+ bool visible = FRAME_VISIBLE_P (f);
/* While a frame is unmapped, display generation is
disabled; you don't want to spend time updating a
display that won't ever be seen. */
- f->async_visible = 0;
+ SET_FRAME_VISIBLE (f, 0);
/* We can't distinguish, from the event, whether the window
has become iconified or invisible. So assume, if it
was previously visible, than now it is iconified.
But x_make_frame_invisible clears both
the visible flag and the iconified flag;
and that way, we know the window is not iconified now. */
- if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f))
+ if (visible || FRAME_ICONIFIED_P (f))
{
- f->async_iconified = 1;
-
+ SET_FRAME_ICONIFIED (f, 1);
inev.ie.kind = ICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
f = x_top_window_to_frame (dpyinfo, event.xmap.window);
if (f)
{
+ bool iconified = FRAME_ICONIFIED_P (f);
/* wait_reading_process_output will notice this and update
the frame's display structures.
If we where iconified, we should not set garbaged,
because that stops redrawing on Expose events. This looks
bad if we are called from a recursive event loop
(x_dispatch_event), for example when a dialog is up. */
- if (! f->async_iconified)
+ if (!iconified)
SET_FRAME_GARBAGED (f);
/* Check if fullscreen was specified before we where mapped the
if (!f->output_data.x->has_been_visible)
x_check_fullscreen (f);
- f->async_visible = 1;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 1);
+ SET_FRAME_ICONIFIED (f, 0);
f->output_data.x->has_been_visible = 1;
- if (f->iconified)
+ if (iconified)
{
inev.ie.kind = DEICONIFY_EVENT;
XSETFRAME (inev.ie.frame_or_window, f);
}
- else if (! NILP (Vframe_list)
- && ! NILP (XCDR (Vframe_list)))
- /* Force a redisplay sooner or later
- to update the frame titles
- in case this is the second frame. */
+ else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list)))
+ /* Force a redisplay sooner or later to update the
+ frame titles in case this is the second frame. */
record_asynch_buffer_change ();
#ifdef USE_GTK
if (tmp_data) XFree (tmp_data);
x_uncatch_errors ();
unblock_input ();
- return ! f->iconified;
+ return !FRAME_ICONIFIED_P (f);
}
x_uncatch_errors ();
static void
XTfullscreen_hook (FRAME_PTR f)
{
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
{
block_input ();
x_check_fullscreen (f);
/* But the ConfigureNotify may in fact never arrive, and then this is
not right if the frame is visible. Instead wait (with timeout)
for the ConfigureNotify. */
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
x_wait_for_event (f, ConfigureNotify);
else
{
x_raise_frame (struct frame *f)
{
block_input ();
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
-
XFlush (FRAME_X_DISPLAY (f));
unblock_input ();
}
static void
x_lower_frame (struct frame *f)
{
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
{
block_input ();
XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
{
/* See XEmbed Protocol Specification at
http://freedesktop.org/wiki/Specifications/xembed-spec */
- if (f->async_visible)
+ if (FRAME_VISIBLE_P (f))
xembed_send_message (f, CurrentTime,
XEMBED_REQUEST_FOCUS, 0, 0, 0);
}
http://freedesktop.org/wiki/Specifications/wm-spec */
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
- if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window))
+
+ if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window))
{
Lisp_Object frame;
XSETFRAME (frame, f);
poll_for_input_1 ();
poll_suppress_count = old_poll_suppress_count;
}
-
- /* See if a MapNotify event has been processed. */
- FRAME_SAMPLE_VISIBILITY (f);
}
/* 2000-09-28: In
So we can't win using the usual strategy of letting
FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
and synchronize with the server to make sure we agree. */
- f->visible = 0;
- FRAME_ICONIFIED_P (f) = 0;
- f->async_visible = 0;
- f->async_iconified = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 0);
x_sync (f);
if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f)
FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0;
- if (f->async_iconified)
+ if (FRAME_ICONIFIED_P (f))
return;
block_input ();
- FRAME_SAMPLE_VISIBILITY (f);
-
type = x_icon_type (f);
if (!NILP (type))
x_bitmap_icon (f, type);
gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f));
gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
- f->iconified = 1;
- f->visible = 1;
- f->async_iconified = 1;
- f->async_visible = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 1);
unblock_input ();
return;
}
/* The server won't give us any event to indicate
that an invisible frame was changed to an icon,
so we have to record it here. */
- f->iconified = 1;
- f->visible = 1;
- f->async_iconified = 1;
- f->async_visible = 0;
+ SET_FRAME_VISIBLE (f, 0);
+ SET_FRAME_ICONIFIED (f, 1);
unblock_input ();
return;
}
if (!result)
error ("Can't notify window manager of iconification");
- f->async_iconified = 1;
- f->async_visible = 0;
-
+ SET_FRAME_ICONIFIED (f, 1);
+ SET_FRAME_VISIBLE (f, 0);
block_input ();
XFlush (FRAME_X_DISPLAY (f));
XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
}
- f->async_iconified = 1;
- f->async_visible = 0;
+ SET_FRAME_ICONIFIED (f, 1);
+ SET_FRAME_VISIBLE (f, 0);
XFlush (FRAME_X_DISPLAY (f));
unblock_input ();
Vx_toolkit_scroll_bars = Qnil;
#endif
+ DEFVAR_BOOL ("scroll-bar-adjust-thumb-portion",
+ scroll_bar_adjust_thumb_portion_p,
+ doc: /* Adjust thumb for overscrolling for Gtk+ and MOTIF.
+Non-nil means adjust the thumb in the scroll bar so it can be dragged downwards
+even if the end of the buffer is shown (i.e. overscrolling).
+Set to nil if you want the thumb to be at the bottom when the end of the buffer
+is shown. Also, the thumb fills the whole scroll bar when the entire buffer
+is visible. In this case you can not overscroll. */);
+ scroll_bar_adjust_thumb_portion_p = 1;
+
staticpro (&last_mouse_motion_frame);
last_mouse_motion_frame = Qnil;