static void x_initialize (void);
-/* Flush display of frame F, or of all frames if F is null. */
+/* Flush display of frame F. */
static void
x_flush (struct frame *f)
{
+ eassert (f && FRAME_X_P (f));
/* Don't call XFlush when it is not safe to redisplay; the X
connection may be broken. */
if (!NILP (Vinhibit_redisplay))
return;
block_input ();
- if (f)
- {
- eassert (FRAME_X_P (f));
- XFlush (FRAME_X_DISPLAY (f));
- }
- else
- {
- /* Flush all displays and so all frames on them. */
- struct x_display_info *xdi;
- for (xdi = x_display_list; xdi; xdi = xdi->next)
- XFlush (xdi->display);
- }
+ XFlush (FRAME_X_DISPLAY (f));
unblock_input ();
}
static Lisp_Object window_being_scrolled;
-/* Last scroll bar part sent in xm_scroll_callback. */
-
-static int last_scroll_bar_part;
-
/* Whether this is an Xaw with arrow-scrollbars. This should imply
that movements of 1/20 of the screen size are mapped to up/down. */
&& WINDOWP (window_being_scrolled))
{
struct window *w;
+ struct scroll_bar *bar;
x_send_scroll_bar_event (window_being_scrolled,
scroll_bar_end_scroll, 0, 0);
w = XWINDOW (window_being_scrolled);
+ bar = XSCROLL_BAR (w->vertical_scroll_bar);
- if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging))
+ if (bar->dragging != -1)
{
- XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil;
+ bar->dragging = -1;
/* The thumb size is incorrect while dragging: fix it. */
set_vertical_scroll_bar (w);
}
window_being_scrolled = Qnil;
- last_scroll_bar_part = -1;
-
+#if defined (USE_LUCID)
+ bar->last_seen_part = scroll_bar_nowhere;
+#endif
/* Xt timeouts no longer needed. */
toolkit_scroll_bar_interaction = 0;
}
switch (cs->reason)
{
case XmCR_DECREMENT:
- bar->dragging = Qnil;
+ bar->dragging = -1;
part = scroll_bar_up_arrow;
break;
case XmCR_INCREMENT:
- bar->dragging = Qnil;
+ bar->dragging = -1;
part = scroll_bar_down_arrow;
break;
case XmCR_PAGE_DECREMENT:
- bar->dragging = Qnil;
+ bar->dragging = -1;
part = scroll_bar_above_handle;
break;
case XmCR_PAGE_INCREMENT:
- bar->dragging = Qnil;
+ bar->dragging = -1;
part = scroll_bar_below_handle;
break;
case XmCR_TO_TOP:
- bar->dragging = Qnil;
+ bar->dragging = -1;
part = scroll_bar_to_top;
break;
case XmCR_TO_BOTTOM:
- bar->dragging = Qnil;
+ bar->dragging = -1;
part = scroll_bar_to_bottom;
break;
whole = XM_SB_MAX - slider_size;
portion = min (cs->value, whole);
part = scroll_bar_handle;
- bar->dragging = make_number (cs->value);
+ bar->dragging = cs->value;
}
break;
if (part >= 0)
{
window_being_scrolled = bar->window;
- last_scroll_bar_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
}
whole = gtk_adjustment_get_upper (adj) -
gtk_adjustment_get_page_size (adj);
portion = min ((int)position, whole);
- bar->dragging = make_number ((int)portion);
+ bar->dragging = portion;
}
break;
case GTK_SCROLL_STEP_BACKWARD:
part = scroll_bar_up_arrow;
- bar->dragging = Qnil;
+ bar->dragging = -1;
break;
case GTK_SCROLL_STEP_FORWARD:
part = scroll_bar_down_arrow;
- bar->dragging = Qnil;
+ bar->dragging = -1;
break;
case GTK_SCROLL_PAGE_BACKWARD:
part = scroll_bar_above_handle;
- bar->dragging = Qnil;
+ bar->dragging = -1;
break;
case GTK_SCROLL_PAGE_FORWARD:
part = scroll_bar_below_handle;
- bar->dragging = Qnil;
+ bar->dragging = -1;
break;
}
if (part >= 0)
{
window_being_scrolled = bar->window;
- last_scroll_bar_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
return FALSE;
}
-/* Callback for button release. Sets dragging to Qnil when dragging is done. */
+/* Callback for button release. Sets dragging to -1 when dragging is done. */
static gboolean
xg_end_scroll_callback (GtkWidget *widget,
gpointer user_data)
{
struct scroll_bar *bar = user_data;
- bar->dragging = Qnil;
+ bar->dragging = -1;
if (WINDOWP (window_being_scrolled))
{
x_send_scroll_bar_event (window_being_scrolled,
float top = *top_addr;
float shown;
int whole, portion, height;
- int part;
+ enum scroll_bar_part part;
/* Get the size of the thumb, a value between 0 and 1. */
block_input ();
part = scroll_bar_handle;
window_being_scrolled = bar->window;
- bar->dragging = make_number (portion);
- last_scroll_bar_part = part;
+ bar->dragging = portion;
+ bar->last_seen_part = part;
x_send_scroll_bar_event (bar->window, part, portion, whole);
}
/* The position really is stored cast to a pointer. */
int position = (intptr_t) call_data;
Dimension height;
- int part;
+ enum scroll_bar_part part;
/* Get the height of the scroll bar. */
block_input ();
part = scroll_bar_move_ratio;
window_being_scrolled = bar->window;
- bar->dragging = Qnil;
- last_scroll_bar_part = part;
+ bar->dragging = -1;
+ bar->last_seen_part = part;
x_send_scroll_bar_event (bar->window, part, position, height);
}
shown = (float) portion / whole;
}
- if (NILP (bar->dragging))
+ if (bar->dragging == -1)
{
int size, value;
NULL);
/* Massage the top+shown values. */
- if (NILP (bar->dragging) || last_scroll_bar_part == scroll_bar_down_arrow)
+ if (bar->dragging == -1 || bar->last_seen_part == scroll_bar_down_arrow)
top = max (0, min (1, top));
else
top = old_top;
for `NARROWPROTO'. See s/freebsd.h for an example. */
if (top != old_top || shown != old_shown)
{
- if (NILP (bar->dragging))
+ if (bar->dragging == -1)
XawScrollbarSetThumb (widget, top, shown);
else
{
bar->height = height;
bar->start = 0;
bar->end = 0;
- bar->dragging = Qnil;
+ bar->dragging = -1;
bar->fringe_extended_p = 0;
+#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
+ bar->last_seen_part = scroll_bar_nowhere;
+#endif
/* Add bar to its frame's list of scroll bars. */
bar->next = FRAME_SCROLL_BARS (f);
static void
x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild)
{
- int dragging = ! NILP (bar->dragging);
+ bool dragging = bar->dragging != -1;
Window w = bar->x_window;
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
GC gc = f->output_data.x->normal_gc;
#else /* not USE_TOOLKIT_SCROLL_BARS */
/* Set the scroll bar's current state, unless we're currently being
dragged. */
- if (NILP (bar->dragging))
+ if (bar->dragging == -1)
{
int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height);
#ifndef USE_TOOLKIT_SCROLL_BARS
/* If the user has released the handle, set it to its final position. */
- if (event->type == ButtonRelease
- && ! NILP (bar->dragging))
+ if (event->type == ButtonRelease && bar->dragging != -1)
{
- int new_start = y - XINT (bar->dragging);
+ int new_start = y - bar->dragging;
int new_end = new_start + bar->end - bar->start;
x_scroll_bar_set_handle (bar, new_start, new_end, 0);
- bar->dragging = Qnil;
+ bar->dragging = -1;
}
#endif
XSETVECTOR (last_mouse_scroll_bar, bar);
/* If we're dragging the bar, display it. */
- if (! NILP (bar->dragging))
+ if (bar->dragging != -1)
{
/* Where should the handle be now? */
- int new_start = event->y - XINT (bar->dragging);
+ int new_start = event->y - bar->dragging;
if (new_start != bar->start)
{
win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER;
- if (! NILP (bar->dragging))
- win_y -= XINT (bar->dragging);
+ if (bar->dragging != -1)
+ win_y -= bar->dragging;
if (win_y < 0)
win_y = 0;
*fp = f;
*bar_window = bar->window;
- if (! NILP (bar->dragging))
+ if (bar->dragging != -1)
*part = scroll_bar_handle;
else if (win_y < bar->start)
*part = scroll_bar_above_handle;
f = x_any_window_to_frame (dpyinfo, event.xkey.window);
+#if ! defined (USE_GTK)
/* If mouse-highlight is an integer, input clears out
mouse highlighting. */
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
clear_mouse_face (hlinfo);
hlinfo->mouse_face_hidden = 1;
}
+#endif
#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
if (f == 0)
#endif
if (f)
{
+#if ! defined (USE_GTK)
/* Is this in the tool-bar? */
if (WINDOWP (f->tool_bar_window)
&& WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
tool_bar_p = EQ (window, f->tool_bar_window);
if (tool_bar_p && event.xbutton.button < 4)
- {
- handle_tool_bar_click (f, x, y,
- event.xbutton.type == ButtonPress,
- x_x_to_emacs_modifiers (dpyinfo,
- event.xbutton.state));
- }
+ handle_tool_bar_click
+ (f, x, y, event.xbutton.type == ButtonPress,
+ x_x_to_emacs_modifiers (dpyinfo, event.xbutton.state));
}
+#endif /* !USE_GTK */
if (!tool_bar_p)
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
#endif
}
-#ifndef XFlush
XFlush (FRAME_X_DISPLAY (f));
-#endif
}
\f
if (change_gravity > 0)
{
- FRAME_X_OUTPUT (f)->left_before_move = f->left_pos;
- FRAME_X_OUTPUT (f)->top_before_move = f->top_pos;
-
f->top_pos = yoff;
f->left_pos = xoff;
f->size_hint_flags &= ~ (XNegative | YNegative);
dpyinfo->x_dnd_atoms_size = 8;
dpyinfo->x_dnd_atoms = xmalloc (sizeof *dpyinfo->x_dnd_atoms
* dpyinfo->x_dnd_atoms_size);
-
- connection = ConnectionNumber (dpyinfo->display);
- dpyinfo->connection = connection;
dpyinfo->gray
= XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
gray_bits, gray_width, gray_height,
xsettings_initialize (dpyinfo);
+ connection = ConnectionNumber (dpyinfo->display);
+
/* This is only needed for distinguishing keyboard and process input. */
if (connection != 0)
add_keyboard_wait_descriptor (connection);
break;
}
- delete_keyboard_wait_descriptor (dpyinfo->connection);
-
/* Discard this display from x_display_name_list and x_display_list.
We can't use Fdelq because that can quit. */
if (! NILP (x_display_name_list)
x_update_window_begin,
x_update_window_end,
x_flush,
-#ifdef XFlush
- x_flush,
-#else
- 0, /* flush_display_optional */
-#endif
x_clear_window_mouse_face,
x_get_glyph_overhangs,
x_fix_overlapping_area,
x_delete_terminal (struct terminal *terminal)
{
struct x_display_info *dpyinfo = terminal->display_info.x;
+ int connection = -1;
/* Protect against recursive calls. delete_frame in
delete_terminal calls us back when it deletes our last frame. */
and dpyinfo->display was set to 0 to indicate that. */
if (dpyinfo->display)
{
+ connection = ConnectionNumber (dpyinfo->display);
+
x_destroy_all_bitmaps (dpyinfo);
XSetCloseDownMode (dpyinfo->display, DestroyAll);
#endif /* ! USE_GTK */
}
+ /* No more input on this descriptor. */
+ if (connection != -1)
+ delete_keyboard_wait_descriptor (connection);
+
/* Mark as dead. */
dpyinfo->display = NULL;
x_delete_display (dpyinfo);