specified a name for the frame; the name will override any set by the
redisplay code. */
static void
-x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
+pgtk_explicitly_set_name (struct frame *f, Lisp_Object arg,
+ Lisp_Object oldval)
{
pgtk_set_name (f, arg, true);
}
else
nlines = 0;
- x_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
+ pgtk_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
}
-
/* Set the pixel height of the tab bar of frame F to HEIGHT. */
void
-x_change_tab_bar_height (struct frame *f, int height)
+pgtk_change_tab_bar_height (struct frame *f, int height)
{
int unit = FRAME_LINE_HEIGHT (f);
int old_height = FRAME_TAB_BAR_HEIGHT (f);
pgtk_clear_under_internal_border (f);
}
}
-
}
static void
pgtk_set_internal_border_width (struct frame *f, Lisp_Object arg,
- Lisp_Object oldval)
+ Lisp_Object oldval)
{
int border = check_int_nonnegative (arg);
unblock_input ();
}
-/* This is the same as the xfns.c definition. */
static void
pgtk_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
set_frame_cursor_types (f, arg);
}
-/* called to set mouse pointer color, but all other terms use it to
- initialize pointer types (and don't set the color ;) */
static void
pgtk_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
}
-/**
- * pgtk_set_undecorated:
- *
- * Set frame F's `undecorated' parameter. If non-nil, F's window-system
- * window is drawn without decorations, title, minimize/maximize boxes
- * and external borders. This usually means that the window cannot be
- * dragged, resized, iconified, maximized or deleted with the mouse. If
- * nil, draw the frame with all the elements listed above unless these
- * have been suspended via window manager settings.
- *
- * Some window managers may not honor this parameter.
- */
static void
pgtk_set_undecorated (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value)
}
}
-/**
- * pgtk_set_skip_taskbar:
- *
- * Set frame F's `skip-taskbar' parameter. If non-nil, this should
- * remove F's icon from the taskbar associated with the display of F's
- * window-system window and inhibit switching to F's window via
- * <Alt>-<TAB>. If nil, lift these restrictions.
- *
- * Some window managers may not honor this parameter.
- */
static void
pgtk_set_skip_taskbar (struct frame *f, Lisp_Object new_value,
Lisp_Object old_value)
}
}
-/**
- * pgtk_set_override_redirect:
- *
- * Set frame F's `override_redirect' parameter which, if non-nil, hints
- * that the window manager doesn't want to deal with F. Usually, such
- * frames have no decorations and always appear on top of all frames.
- *
- * Some window managers may not honor this parameter.
- */
static void
pgtk_set_override_redirect (struct frame *f, Lisp_Object new_value,
- Lisp_Object old_value)
+ Lisp_Object old_value)
{
if (!EQ (new_value, old_value))
{
}
}
-/* Set icon from FILE for frame F. By using GTK functions the icon
- may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */
-
+/* Set icon from FILE for frame F. */
bool
xg_set_icon (struct frame *f, Lisp_Object file)
{
return pgtk_cr_export_frames (frames, surface_type);
}
-
-/* Note: see frame.c for template, also where generic functions are impl */
-frame_parm_handler pgtk_frame_parm_handlers[] = {
- gui_set_autoraise, /* generic OK */
- gui_set_autolower, /* generic OK */
- pgtk_set_background_color,
- pgtk_set_border_color,
- gui_set_border_width,
- pgtk_set_cursor_color,
- pgtk_set_cursor_type,
- gui_set_font, /* generic OK */
- pgtk_set_foreground_color,
- pgtk_set_icon_name,
- pgtk_set_icon_type,
- pgtk_set_child_frame_border_width,
- pgtk_set_internal_border_width, /* generic OK */
- gui_set_right_divider_width,
- gui_set_bottom_divider_width,
- pgtk_set_menu_bar_lines,
- pgtk_set_mouse_color,
- x_explicitly_set_name,
- gui_set_scroll_bar_width, /* generic OK */
- gui_set_scroll_bar_height, /* generic OK */
- pgtk_set_title,
- gui_set_unsplittable, /* generic OK */
- gui_set_vertical_scroll_bars, /* generic OK */
- gui_set_horizontal_scroll_bars, /* generic OK */
- gui_set_visibility, /* generic OK */
- pgtk_set_tab_bar_lines,
- pgtk_set_tool_bar_lines,
- pgtk_set_scroll_bar_foreground,
- pgtk_set_scroll_bar_background,
- gui_set_screen_gamma, /* generic OK */
- gui_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */
- gui_set_left_fringe, /* generic OK */
- gui_set_right_fringe, /* generic OK */
- 0, /* x_set_wait_for_wm */
- gui_set_fullscreen, /* generic OK */
- gui_set_font_backend, /* generic OK */
- gui_set_alpha,
- pgtk_set_sticky,
- pgtk_set_tool_bar_position,
- 0, /* x_set_inhibit_double_buffering */
- pgtk_set_undecorated,
- pgtk_set_parent_frame,
- pgtk_set_skip_taskbar,
- pgtk_set_no_focus_on_map,
- pgtk_set_no_accept_focus,
- pgtk_set_z_group,
- pgtk_set_override_redirect,
- gui_set_no_special_glyphs,
- pgtk_set_alpha_background,
-};
+frame_parm_handler pgtk_frame_parm_handlers[] =
+ {
+ gui_set_autoraise, /* generic OK */
+ gui_set_autolower, /* generic OK */
+ pgtk_set_background_color,
+ pgtk_set_border_color,
+ gui_set_border_width,
+ pgtk_set_cursor_color,
+ pgtk_set_cursor_type,
+ gui_set_font, /* generic OK */
+ pgtk_set_foreground_color,
+ pgtk_set_icon_name,
+ pgtk_set_icon_type,
+ pgtk_set_child_frame_border_width,
+ pgtk_set_internal_border_width, /* generic OK */
+ gui_set_right_divider_width,
+ gui_set_bottom_divider_width,
+ pgtk_set_menu_bar_lines,
+ pgtk_set_mouse_color,
+ pgtk_explicitly_set_name,
+ gui_set_scroll_bar_width, /* generic OK */
+ gui_set_scroll_bar_height, /* generic OK */
+ pgtk_set_title,
+ gui_set_unsplittable, /* generic OK */
+ gui_set_vertical_scroll_bars, /* generic OK */
+ gui_set_horizontal_scroll_bars, /* generic OK */
+ gui_set_visibility, /* generic OK */
+ pgtk_set_tab_bar_lines,
+ pgtk_set_tool_bar_lines,
+ pgtk_set_scroll_bar_foreground,
+ pgtk_set_scroll_bar_background,
+ gui_set_screen_gamma, /* generic OK */
+ gui_set_line_spacing, /* generic OK, sets f->extra_line_spacing to int */
+ gui_set_left_fringe, /* generic OK */
+ gui_set_right_fringe, /* generic OK */
+ 0,
+ gui_set_fullscreen, /* generic OK */
+ gui_set_font_backend, /* generic OK */
+ gui_set_alpha,
+ pgtk_set_sticky,
+ pgtk_set_tool_bar_position,
+ 0,
+ pgtk_set_undecorated,
+ pgtk_set_parent_frame,
+ pgtk_set_skip_taskbar,
+ pgtk_set_no_focus_on_map,
+ pgtk_set_no_accept_focus,
+ pgtk_set_z_group,
+ pgtk_set_override_redirect,
+ gui_set_no_special_glyphs,
+ pgtk_set_alpha_background,
+ };
/* Handler for signals raised during x_create_frame and
If you set scale factor by this function, it is used instead of Gdk's one.
Pass nil as SCALE-FACTOR if you want to reset the specified monitor's
-scale factor. */ )
+scale factor. */)
(Lisp_Object monitor_model, Lisp_Object scale_factor)
{
CHECK_STRING (monitor_model);
return result;
}
-
-DEFUN ("pgtk-hide-others", Fpgtk_hide_others, Spgtk_hide_others, 0, 0, 0,
- doc: /* Hides all applications other than Emacs. */)
- (void)
-{
- check_window_system (NULL);
- return Qnil;
-}
-
-DEFUN ("pgtk-hide-emacs", Fpgtk_hide_emacs, Spgtk_hide_emacs, 1, 1, 0,
- doc: /* If ON is non-nil, the entire Emacs application is hidden.
-Otherwise if Emacs is hidden, it is unhidden.
-If ON is equal to `activate', Emacs is unhidden and becomes
-the active application. */)
- (Lisp_Object on)
-{
- check_window_system (NULL);
- return Qnil;
-}
-
-
DEFUN ("pgtk-font-name", Fpgtk_font_name, Spgtk_font_name, 1, 1, 0,
doc: /* Determine font PostScript or family name for font NAME.
NAME should be a string containing either the font name or an XLFD
return check_pgtk_display_info (frame);
}
-
void
pgtk_set_scroll_bar_default_width (struct frame *f)
{
return res;
}
-
Lisp_Object
-x_get_focus_frame (struct frame *frame)
+pgtk_get_focus_frame (struct frame *frame)
{
struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (frame);
Lisp_Object focus;
return Qnil;
}
-
DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
doc: /* Internal function called by `display-color-p', which see. */)
(Lisp_Object terminal)
return Qt;
}
-
DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, 0, 1, 0,
doc: /* Return t if the display supports shades of gray.
Note that color displays do support shades of gray.
return Qnil;
}
-
DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, 0, 1, 0,
doc: /* Return the width in pixels of the display TERMINAL.
The optional argument TERMINAL specifies which display to ask about.
return make_fixnum (width);
}
-
DEFUN ("x-display-pixel-height", Fx_display_pixel_height, Sx_display_pixel_height, 0, 1, 0,
doc: /* Return the height in pixels of the display TERMINAL.
The optional argument TERMINAL specifies which display to ask about.
/* Hide tooltip. Delete its frame if DELETE is true. */
static Lisp_Object
-x_hide_tip (bool delete)
+pgtk_hide_tip (bool delete)
{
if (!NILP (tip_timer))
{
}
}
- x_hide_tip (delete);
+ pgtk_hide_tip (delete);
}
else
- x_hide_tip (true);
+ pgtk_hide_tip (true);
}
else
- x_hide_tip (true);
+ pgtk_hide_tip (true);
tip_last_frame = frame;
tip_last_string = string;
Value is t if tooltip was open, nil otherwise. */)
(void)
{
- return x_hide_tip (!tooltip_reuse_hidden_frame);
+ return pgtk_hide_tip (!tooltip_reuse_hidden_frame);
}
/* Return geometric attributes of FRAME. According to the value of
int left_pos, top_pos;
if (FRAME_GTK_OUTER_WIDGET (f))
- {
- gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- &left_pos, &top_pos);
- }
+ gtk_window_get_position (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ &left_pos, &top_pos);
else
{
GtkAllocation alloc;
g_free (ver);
}
-
defsubr (&Spgtk_set_resource);
defsubr (&Sxw_display_color_p); /* this and next called directly by C code */
defsubr (&Sx_display_grayscale_p);
defsubr (&Sx_display_list);
defsubr (&Sx_gtk_debug);
- defsubr (&Spgtk_hide_others);
- defsubr (&Spgtk_hide_emacs);
-
defsubr (&Sx_show_tip);
defsubr (&Sx_hide_tip);
-/* Pure Gtk+-3 communication module. -*- coding: utf-8 -*-
+/* Communication module for window systems using GTK.
Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2022 Free Software
Foundation, Inc.
if (cr != FRAME_CR_CONTEXT (f))
{
cairo_destroy (cr);
- FRAME_CR_ACTIVE_CONTEXT (f) = cairo_reference (FRAME_CR_CONTEXT (f));
+ FRAME_CR_ACTIVE_CONTEXT (f)
+ = cairo_reference (FRAME_CR_CONTEXT (f));
}
unblock_input ();
}
{
if (FLOATP (Vpgtk_wait_for_event_timeout))
{
- guint msec =
- (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000);
+ guint msec
+ = (guint) (XFLOAT_DATA (Vpgtk_wait_for_event_timeout) * 1000);
int found = 0;
int timed_out = 0;
- gulong id =
- g_signal_connect (FRAME_WIDGET (f), "map-event",
- G_CALLBACK
- (pgtk_make_frame_visible_wait_for_map_event_cb),
- &found);
- guint src =
- g_timeout_add (msec,
- pgtk_make_frame_visible_wait_for_map_event_timeout,
- &timed_out);
+ gulong id
+ = g_signal_connect (FRAME_WIDGET (f), "map-event",
+ G_CALLBACK
+ (pgtk_make_frame_visible_wait_for_map_event_cb),
+ &found);
+ guint src
+ = g_timeout_add (msec,
+ pgtk_make_frame_visible_wait_for_map_event_timeout,
+ &timed_out);
if (!multiple_times)
{
}
g_signal_handler_disconnect (FRAME_WIDGET (f), id);
+
if (!timed_out)
g_source_remove (src);
}
void
pgtk_make_frame_visible (struct frame *f)
-/* --------------------------------------------------------------------------
- External: Show the window (X11 semantics)
- -------------------------------------------------------------------------- */
{
GtkWidget *win = FRAME_GTK_OUTER_WIDGET (f);
void
pgtk_make_frame_invisible (struct frame *f)
-/* --------------------------------------------------------------------------
- External: Hide the window (X11 semantics)
- -------------------------------------------------------------------------- */
{
gtk_widget_hide (FRAME_WIDGET (f));
- /* Map events are emitted many times, and
- * map_event() do SET_FRAME_VISIBLE(f, 1).
- * I expect visible = 0, so process those map events here and
- * SET_FRAME_VISIBLE(f, 0) after that.
- */
+ /* Handle any pending map event(s), then make the frame visible
+ manually, to avoid race conditions. */
pgtk_wait_for_map_event (f, true);
SET_FRAME_VISIBLE (f, 0);
{
GtkWidget *whbox_of_f = gtk_widget_get_parent (fixed);
- /* Here, unhighlight can be called and may change border_color_css_provider. */
+ /* Here, unhighlight can be called and may change
+ border_color_css_provider. */
gtk_container_remove (GTK_CONTAINER (whbox_of_f), fixed);
if (FRAME_GTK_OUTER_WIDGET (f))
{
xg_create_frame_outer_widgets (f);
pgtk_set_event_handler (f);
- gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget), fixed, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (f->output_data.pgtk->hbox_widget),
+ fixed, TRUE, TRUE, 0);
f->output_data.pgtk->preferred_width = alloc.width;
f->output_data.pgtk->preferred_height = alloc.height;
xg_wm_set_size_hint (f, 0, 0);
}
}
-
/* Set SRC's clipping for output of glyph string DST. This is called
when we are drawing DST's left_overhang or right_overhang only in
the area of SRC. */
cairo_clip (cr);
}
-
/* RIF:
Compute left and right overhang of glyph string S. */
}
}
-
-/* Fill rectangle X, Y, W, H with background color of glyph string S. */
-
+/* Fill rectangle X, Y, W, H with background color of glyph string
+ S. */
static void
pgtk_clear_glyph_string_rect (struct glyph_string *s, int x, int y,
int w, int h)
|| s->hl != DRAW_CURSOR));
}
-
static void
fill_background_by_face (struct frame *f, struct face *face, int x, int y,
int width, int height)
background even if it wouldn't be drawn normally. This is used
when a string preceding S draws into the background of S, or S
contains the first component of a composition. */
-
static void
pgtk_draw_glyph_string_background (struct glyph_string *s, bool force_p)
{
}
/* Draw the foreground of glyph string S. */
-
static void
pgtk_draw_glyph_string_foreground (struct glyph_string *s)
{
}
/* Draw the foreground of composite glyph string S. */
-
static void
pgtk_draw_composite_glyph_string_foreground (struct glyph_string *s)
{
/* Draw the foreground of glyph string S for glyphless characters. */
-
static void
pgtk_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
{
color = s->xgcv.background;
}
- if (TRUE)
+ if (!di->relief_background_valid_p
+ || di->relief_background != color)
{
+ di->relief_background_valid_p = true;
di->relief_background = color;
pgtk_setup_relief_color (s->f, &di->white_relief, 1.2, 0x8000,
WHITE_PIX_DEFAULT (s->f));
if (n > 0)
{
for (int i = 0; i < n; i++)
- {
- cairo_rectangle (cr,
- rectangles[i].x,
- rectangles[i].y,
- rectangles[i].width, rectangles[i].height);
- }
+ cairo_rectangle (cr, rectangles[i].x, rectangles[i].y,
+ rectangles[i].width, rectangles[i].height);
cairo_clip (cr);
}
}
int left_x, int top_y, int right_x, int bottom_y,
int hwidth, int vwidth, bool raised_p, bool top_p,
bool bot_p, bool left_p, bool right_p,
- XRectangle * clip_rect)
+ XRectangle *clip_rect)
{
unsigned long top_left_color, bottom_right_color;
int corners = 0;
int h)
{
if (s->stippled_p)
- {
- /* Fill background with a stipple pattern. */
-
- fill_background (s, x, y, w, h);
- }
+ fill_background (s, x, y, w, h);
else
pgtk_clear_glyph_string_rect (s, x, y, w, h);
}
if (s->hl == DRAW_CURSOR)
{
int relief = eabs (s->img->relief);
- pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief, y - relief,
- s->slice.width + relief*2 - 1,
- s->slice.height + relief*2 - 1, false);
+ pgtk_draw_rectangle (s->f, s->xgcv.foreground, x - relief,
+ y - relief, s->slice.width + relief * 2 - 1,
+ s->slice.height + relief * 2 - 1, false);
}
}
pgtk_end_cr_clip (s->f);
|| s->img->pixmap == 0
|| s->width != s->background_width)
{
- {
- int x = s->x;
- int y = s->y;
- int width = s->background_width;
+ int x = s->x;
+ int y = s->y;
+ int width = s->background_width;
- if (s->first_glyph->left_box_line_p
- && s->slice.x == 0)
- {
- x += box_line_hwidth;
- width -= box_line_hwidth;
- }
+ if (s->first_glyph->left_box_line_p
+ && s->slice.x == 0)
+ {
+ x += box_line_hwidth;
+ width -= box_line_hwidth;
+ }
- if (s->slice.y == 0)
- y += box_line_vwidth;
+ if (s->slice.y == 0)
+ y += box_line_vwidth;
- pgtk_draw_glyph_string_bg_rect (s, x, y, width, height);
- }
+ pgtk_draw_glyph_string_bg_rect (s, x, y, width, height);
s->background_filled_p = true;
}
pgtk_set_clip_rectangles (s->f, cr, &r, 1);
if (s->face->stipple)
- {
- /* Fill background with a stipple pattern. */
- fill_background (s, x, y, w, h);
- }
+ fill_background (s, x, y, w, h);
else
- {
- pgtk_fill_rectangle (s->f, color, x, y, w, h,
- true);
- }
+ pgtk_fill_rectangle (s->f, color, x, y, w, h,
+ true);
pgtk_end_cr_clip (s->f);
}
background_width -= text_left_x - x;
x = text_left_x;
}
+
if (background_width > 0)
pgtk_draw_glyph_string_bg_rect (s, x, s->y, background_width, s->height);
}
/* We must clip just this glyph. left_overhang part has already
drawn when s->prev was drawn, and right_overhang part will be
drawn later when s->next is drawn. */
- pgtk_set_glyph_string_clipping_exactly (s, s, cr);
+ pgtk_set_glyph_string_clipping_exactly (s, s, cr);
else
- pgtk_set_glyph_string_clipping (s, cr);
+ pgtk_set_glyph_string_clipping (s, cr);
switch (s->first_glyph->type)
{
pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, s->y + dy,
s->width, h, false);
else
- {
- pgtk_fill_rectangle (s->f, s->face->overline_color, s->x,
- s->y + dy, s->width, h, false);
- }
+ pgtk_fill_rectangle (s->f, s->face->overline_color, s->x,
+ s->y + dy, s->width, h, false);
}
/* Draw strike-through. */
pgtk_fill_rectangle (s->f, s->xgcv.foreground, s->x, glyph_y + dy,
s->width, h, false);
else
- {
- pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x,
- glyph_y + dy, s->width, h, false);
- }
+ pgtk_fill_rectangle (s->f, s->face->strike_through_color, s->x,
+ glyph_y + dy, s->width, h, false);
}
if (s->prev)
cairo_t *cr;
cairo_surface_t *surface; /* temporary surface */
- surface =
- cairo_surface_create_similar (FRAME_CR_SURFACE (f),
- CAIRO_CONTENT_COLOR_ALPHA,
- (int) src_rect->width,
- (int) src_rect->height);
+ surface
+ = cairo_surface_create_similar (FRAME_CR_SURFACE (f),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ (int) src_rect->width,
+ (int) src_rect->height);
cr = cairo_create (surface);
cairo_set_source_surface (cr, FRAME_CR_SURFACE (f), -src_rect->x,
}
if (FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img != NULL)
- {
- gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
- FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img);
- }
+ gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+ FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img);
+
f->output_data.pgtk->icon_bitmap = bitmap_id;
return false;
{
i = max_fringe_bmp;
max_fringe_bmp = which + 20;
- fringe_bmp =
- (cairo_pattern_t **) xrealloc (fringe_bmp,
- max_fringe_bmp *
- sizeof (cairo_pattern_t *));
+ fringe_bmp
+ = (cairo_pattern_t **) xrealloc (fringe_bmp,
+ max_fringe_bmp *
+ sizeof (cairo_pattern_t *));
while (i < max_fringe_bmp)
fringe_bmp[i++] = 0;
}
struct timespec ts = make_timespec (0, 50 * 1000 * 1000);
if (hourglass_atimer != NULL)
cancel_atimer (hourglass_atimer);
- hourglass_atimer =
- start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
+ hourglass_atimer
+ = start_atimer (ATIMER_CONTINUOUS, ts, hourglass_cb, NULL);
}
-
- /* Cursor frequently stops animation. gtk's bug? */
}
static void
static void
pgtk_flash (struct frame *f)
{
- {
- if (!FRAME_CR_CONTEXT (f))
- return;
+ cairo_surface_t *surface_orig, *surface;
+ cairo_t *cr;
+ int width, height, flash_height, flash_left, flash_right;
+ struct timespec delay;
- block_input ();
+ if (!FRAME_CR_CONTEXT (f))
+ return;
- cairo_surface_t *surface_orig = FRAME_CR_SURFACE (f);
+ block_input ();
- int width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
- int height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
- cairo_surface_t *surface
- = cairo_surface_create_similar (surface_orig, CAIRO_CONTENT_COLOR_ALPHA,
- width, height);
+ surface_orig = FRAME_CR_SURFACE (f);
- cairo_t *cr = cairo_create (surface);
- cairo_set_source_surface (cr, surface_orig, 0, 0);
- cairo_rectangle (cr, 0, 0, width, height);
- cairo_clip (cr);
- cairo_paint (cr);
+ width = FRAME_CR_SURFACE_DESIRED_WIDTH (f);
+ height = FRAME_CR_SURFACE_DESIRED_HEIGHT (f);
+ surface = cairo_surface_create_similar (surface_orig,
+ CAIRO_CONTENT_COLOR_ALPHA,
+ width, height);
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
+ cr = cairo_create (surface);
+ cairo_set_source_surface (cr, surface_orig, 0, 0);
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_clip (cr);
+ cairo_paint (cr);
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
+
+ /* Get the height not including a menu bar widget. */
+ height = FRAME_PIXEL_HEIGHT (f);
+ /* Height of each line to flash. */
+ flash_height = FRAME_LINE_HEIGHT (f);
+ /* These will be the left and right margins of the rectangles. */
+ flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
+ flash_right = (FRAME_PIXEL_WIDTH (f)
+ - FRAME_INTERNAL_BORDER_WIDTH (f));
+ width = flash_right - flash_left;
+
+ /* If window is tall, flash top and bottom line. */
+ if (height > 3 * FRAME_LINE_HEIGHT (f))
+ {
+ cairo_rectangle (cr,
+ flash_left,
+ (FRAME_INTERNAL_BORDER_WIDTH (f)
+ + FRAME_TOP_MARGIN_HEIGHT (f)),
+ width, flash_height);
+ cairo_fill (cr);
+
+ cairo_rectangle (cr,
+ flash_left,
+ (height - flash_height
+ - FRAME_INTERNAL_BORDER_WIDTH (f)),
+ width, flash_height);
+ cairo_fill (cr);
+ }
+ else
{
- /* Get the height not including a menu bar widget. */
- int height = FRAME_PIXEL_HEIGHT (f);
- /* Height of each line to flash. */
- int flash_height = FRAME_LINE_HEIGHT (f);
- /* These will be the left and right margins of the rectangles. */
- int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
- int flash_right =
- FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
- int width = flash_right - flash_left;
-
- /* If window is tall, flash top and bottom line. */
- if (height > 3 * FRAME_LINE_HEIGHT (f))
- {
- cairo_rectangle (cr,
- flash_left,
- (FRAME_INTERNAL_BORDER_WIDTH (f)
- + FRAME_TOP_MARGIN_HEIGHT (f)),
- width, flash_height);
- cairo_fill (cr);
+ /* If it is short, flash it all. */
+ cairo_rectangle (cr,
+ flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
+ width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
+ cairo_fill (cr);
+ }
- cairo_rectangle (cr,
- flash_left,
- (height - flash_height
- - FRAME_INTERNAL_BORDER_WIDTH (f)),
- width, flash_height);
- cairo_fill (cr);
- }
- else
- {
- /* If it is short, flash it all. */
- cairo_rectangle (cr,
- flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
- width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
- cairo_fill (cr);
- }
+ FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface;
- FRAME_X_OUTPUT (f)->cr_surface_visible_bell = surface;
- {
- struct timespec delay = make_timespec (0, 50 * 1000 * 1000);
- if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
- {
- cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
- FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
- }
- FRAME_X_OUTPUT (f)->atimer_visible_bell =
- start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
- }
+ delay = make_timespec (0, 50 * 1000 * 1000);
+ if (FRAME_X_OUTPUT (f)->atimer_visible_bell != NULL)
+ {
+ cancel_atimer (FRAME_X_OUTPUT (f)->atimer_visible_bell);
+ FRAME_X_OUTPUT (f)->atimer_visible_bell = NULL;
}
- cairo_destroy (cr);
- unblock_input ();
- }
+ FRAME_X_OUTPUT (f)->atimer_visible_bell
+ = start_atimer (ATIMER_RELATIVE, delay, recover_from_visible_bell, f);
+
+
+ cairo_destroy (cr);
+ unblock_input ();
}
/* Make audible bell. */
EVENT_INIT (inev.ie);
- inev.ie.kind =
- horizontal ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT : SCROLL_BAR_CLICK_EVENT;
+ inev.ie.kind = (horizontal
+ ? HORIZONTAL_SCROLL_BAR_CLICK_EVENT
+ : SCROLL_BAR_CLICK_EVENT);
inev.ie.frame_or_window = window;
inev.ie.arg = Qnil;
inev.ie.timestamp = 0;
xg_set_toolkit_horizontal_scroll_bar_thumb (bar, portion, position, whole);
}
-
-
/* Create a scroll bar and return the scroll bar vector for it. W is
the Emacs window on which to create the scroll bar. TOP, LEFT,
WIDTH and HEIGHT are the pixel coordinates and dimensions of the
wset_vertical_scroll_bar (w, barobj);
}
-
static void
pgtk_set_horizontal_scroll_bar (struct window *w, int portion, int whole,
int position)
}
}
-
/* Un-mark WINDOW's scroll bar for deletion in this judgment cycle.
Note that WINDOW isn't necessarily condemned at all. */
}
static void
-pgtk_free_pixmap (struct frame *_f, Emacs_Pixmap pixmap)
+pgtk_free_pixmap (struct frame *f, Emacs_Pixmap pixmap)
{
if (pixmap)
{
}
}
-
static void
-set_opacity_recursively (GtkWidget * w, gpointer data)
+set_opacity_recursively (GtkWidget *w, gpointer data)
{
gtk_widget_set_opacity (w, *(double *) data);
+
if (GTK_IS_CONTAINER (w))
- gtk_container_foreach (GTK_CONTAINER (w), set_opacity_recursively, data);
+ gtk_container_foreach (GTK_CONTAINER (w),
+ set_opacity_recursively, data);
}
static void
static void
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
- and border pixel are window attributes which are "private to the
- client", so we can always change it to whatever we want. */
block_input ();
- /* I recently started to get errors in this XSetWindowBorder, depending on
- the window-manager in use, tho something more is at play since I've been
- using that same window-manager binary for ever. Let's not crash just
- because of this (bug#9310). */
-
GtkWidget *w = FRAME_WIDGET (f);
- char *css =
- g_strdup_printf ("decoration { border: solid %dpx #%06x; }",
- f->border_width,
- (unsigned int) FRAME_X_OUTPUT (f)->border_pixel & 0x00ffffff);
+ char *css = g_strdup_printf ("decoration { border: solid %dpx #%06x; }",
+ f->border_width,
+ ((unsigned int) FRAME_X_OUTPUT (f)->border_pixel
+ & 0x00ffffff));
GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
GtkCssProvider *css_provider = gtk_css_provider_new ();
static void
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
- and border pixel are window attributes which are "private to the
- client", so we can always change it to whatever we want. */
+ GtkWidget *w;
+ char *css;
+ GtkStyleContext *ctxt;
+ GtkCssProvider *css_provider, *old;
+
block_input ();
- /* Same as above for XSetWindowBorder (bug#9310). */
- GtkWidget *w = FRAME_WIDGET (f);
+ w = FRAME_WIDGET (f);
- char *css =
- g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }",
- f->border_width);
+ css = g_strdup_printf ("decoration { border: dotted %dpx #ffffff; }",
+ f->border_width);
- GtkStyleContext *ctxt = gtk_widget_get_style_context (w);
- GtkCssProvider *css_provider = gtk_css_provider_new ();
+ ctxt = gtk_widget_get_style_context (w);
+ css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (css_provider, css, -1, NULL);
gtk_style_context_add_provider (ctxt, GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
g_free (css);
- GtkCssProvider *old = FRAME_X_OUTPUT (f)->border_color_css_provider;
+ old = FRAME_X_OUTPUT (f)->border_color_css_provider;
FRAME_X_OUTPUT (f)->border_color_css_provider = css_provider;
if (old != NULL)
{
pgtk_frame_rehighlight (FRAME_DISPLAY_INFO (frame));
}
-
/* Set whether or not the mouse pointer should be visible on frame
F. */
-
static void
pgtk_toggle_invisible_pointer (struct frame *f, bool invisible)
{
gdk_window_set_cursor (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
cursor);
f->pointer_invisible = invisible;
+
+ /* This is needed to make the pointer visible upon receiving a
+ motion notify event. */
+ gdk_display_flush (FRAME_X_DISPLAY (f));
}
/* The focus has changed. Update the frames as necessary to reflect
static struct terminal *
pgtk_create_terminal (struct pgtk_display_info *dpyinfo)
-/* --------------------------------------------------------------------------
- Set up use of Gtk before we make the first connection.
- -------------------------------------------------------------------------- */
{
struct terminal *terminal;
terminal->menu_show_hook = pgtk_menu_show;
terminal->activate_menubar_hook = pgtk_activate_menubar;
terminal->popup_dialog_hook = pgtk_popup_dialog;
- terminal->change_tab_bar_height_hook = x_change_tab_bar_height;
+ terminal->change_tab_bar_height_hook = pgtk_change_tab_bar_height;
terminal->set_vertical_scroll_bar_hook = pgtk_set_vertical_scroll_bar;
terminal->set_horizontal_scroll_bar_hook = pgtk_set_horizontal_scroll_bar;
terminal->condemn_scroll_bars_hook = pgtk_condemn_scroll_bars;
= pgtk_set_scroll_bar_default_height;
terminal->set_window_size_hook = pgtk_set_window_size;
terminal->query_colors = pgtk_query_colors;
- terminal->get_focus_frame = x_get_focus_frame;
+ terminal->get_focus_frame = pgtk_get_focus_frame;
terminal->focus_frame_hook = pgtk_focus_frame;
terminal->set_frame_offset_hook = pgtk_set_offset;
terminal->free_pixmap = pgtk_free_pixmap;
};
static void
-pgtk_window_is_of_frame_recursive (GtkWidget * widget, gpointer data)
+pgtk_window_is_of_frame_recursive (GtkWidget *widget, gpointer data)
{
struct pgtk_window_is_of_frame_recursive_t *datap = data;
return;
}
- if (GTK_IS_CONTAINER (widget)) {
+ if (GTK_IS_CONTAINER (widget))
gtk_container_foreach (GTK_CONTAINER (widget),
pgtk_window_is_of_frame_recursive, datap);
- }
}
static bool
-pgtk_window_is_of_frame (struct frame *f, GdkWindow * window)
+pgtk_window_is_of_frame (struct frame *f, GdkWindow *window)
{
struct pgtk_window_is_of_frame_recursive_t data;
data.window = window;
/* Like x_window_to_frame but also compares the window with the widget's
windows. */
static struct frame *
-pgtk_any_window_to_frame (GdkWindow * window)
+pgtk_any_window_to_frame (GdkWindow *window)
{
Lisp_Object tail, frame;
struct frame *f, *found = NULL;
}
static gboolean
-pgtk_handle_draw (GtkWidget * widget, cairo_t * cr, gpointer * data)
+pgtk_handle_draw (GtkWidget *widget, cairo_t *cr, gpointer *data)
{
struct frame *f;
}
static void
-size_allocate (GtkWidget * widget, GtkAllocation * alloc,
+size_allocate (GtkWidget *widget, GtkAllocation *alloc,
gpointer user_data)
{
struct frame *f = pgtk_any_window_to_frame (gtk_widget_get_window (widget));
- /* Between a frame is created and not shown, size is allocated and
- * this handler is called. When that, since the widget's window is
- * NULL, we can't get f, pgtk_cr_update_surface_desired_size is not
- * called, and its size is 0x0. That causes empty frame.
- *
- * Fortunately since we know f in pgtk_set_event_handler, we can get
- * it through user_data;
- */
if (!f)
f = user_data;
void
-pgtk_enqueue_string (struct frame *f, gchar * str)
+pgtk_enqueue_string (struct frame *f, gchar *str)
{
gunichar *ustr, *uptr;
return TRUE;
}
- state |=
- pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
- extra_keyboard_modifiers);
+ state |= pgtk_emacs_to_gtk_modifiers (FRAME_DISPLAY_INFO (f),
+ extra_keyboard_modifiers);
modifiers = state;
/* This will have to go some day... */
|| (orig_keysym & (1 << 28))
|| (keysym != GDK_KEY_VoidSymbol && nbytes == 0))
&& !(event->key.is_modifier
- /* Gtk's modifier keys are different from Xlib's ones.
- * I need to exclude them.
- */
|| IsModifierKey (orig_keysym)
/* The symbols from GDK_KEY_ISO_Lock
to GDK_KEY_ISO_Last_Group_Lock
}
static gboolean
-motion_notify_event (GtkWidget * widget, GdkEvent * event,
- gpointer * user_data)
+motion_notify_event (GtkWidget *widget, GdkEvent *event,
+ gpointer *user_data)
{
union buffered_input_event inev;
struct frame *f, *frame;
struct pgtk_display_info *dpyinfo;
Mouse_HLInfo *hlinfo;
- /* This is needed to make pointer visible when motion_notify event */
- pending_signals = true;
-
EVENT_INIT (inev.ie);
inev.ie.kind = NO_EVENT;
inev.ie.arg = Qnil;
if (f && xg_event_is_for_scrollbar (f, event, false))
f = 0;
+
if (f)
{
/* Maybe generate a SELECT_WINDOW_EVENT for
help_echo_string = previous_help_echo_string;
}
else
- {
- /* If we move outside the frame, then we're
- certainly no longer on any text in the frame. */
- clear_mouse_face (hlinfo);
- }
+ /* If we move outside the frame, then we're
+ certainly no longer on any text in the frame. */
+ clear_mouse_face (hlinfo);
/* If the contents of the global variable help_echo_string
has changed, generate a HELP_EVENT. */