const char *color_name,
Emacs_Color *color)
{
- bool success_p = 0;
- bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
- bool get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0;
+ bool success_p;
+ bool get_bg;
+ bool get_fg;
+#ifdef HAVE_GTK3
+ GtkStyleContext *gsty;
+ GdkRGBA col;
+ char buf[sizeof "rgb://rrrr/gggg/bbbb"];
+ int state;
+ GdkRGBA *c;
+ unsigned short r, g, b;
+#else
+ GtkStyle *gsty;
+ GdkColor *grgb;
+#endif
+
+ get_bg = !strcmp ("gtk_selection_bg_color", color_name);
+ get_fg = !get_bg && !strcmp ("gtk_selection_fg_color", color_name);
+ success_p = false;
- if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg))
+#ifdef HAVE_PGTK
+ while (FRAME_PARENT_FRAME (f))
+ f = FRAME_PARENT_FRAME (f);
+#endif
+
+ if (!FRAME_GTK_WIDGET (f) || !(get_bg || get_fg))
return success_p;
block_input ();
- {
#ifdef HAVE_GTK3
-#ifndef HAVE_PGTK
- GtkStyleContext *gsty
- = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f));
-#else
- GtkStyleContext *gsty
- = gtk_widget_get_style_context (FRAME_WIDGET (f));
-#endif
- GdkRGBA col;
- char buf[sizeof "rgb://rrrr/gggg/bbbb"];
- int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED;
- if (get_fg)
- gtk_style_context_get_color (gsty, state, &col);
- else
- {
- GdkRGBA *c;
- /* FIXME: Retrieving the background color is deprecated in
- GTK+ 3.16. New versions of GTK+ don't use the concept of a
- single background color any more, so we shouldn't query for
- it. */
- gtk_style_context_get (gsty, state,
- GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
- NULL);
- col = *c;
- gdk_rgba_free (c);
- }
+ gsty = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f));
+ state = GTK_STATE_FLAG_SELECTED | GTK_STATE_FLAG_FOCUSED;
+
+ if (get_fg)
+ gtk_style_context_get_color (gsty, state, &col);
+ else
+ {
+ /* FIXME: Retrieving the background color is deprecated in
+ GTK+ 3.16. New versions of GTK+ don't use the concept of a
+ single background color any more, so we shouldn't query for
+ it. */
+ gtk_style_context_get (gsty, state,
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
+ NULL);
+ col = *c;
+ gdk_rgba_free (c);
+ }
- unsigned short
- r = col.red * 65535,
- g = col.green * 65535,
- b = col.blue * 65535;
+ r = col.red * 65535;
+ g = col.green * 65535;
+ b = col.blue * 65535;
#ifndef HAVE_PGTK
- sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b);
- success_p = x_parse_color (f, buf, color) != 0;
+ sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b);
+ success_p = x_parse_color (f, buf, color) != 0;
#else
- sprintf (buf, "#%04x%04x%04x", r, g, b);
- success_p = pgtk_parse_color (f, buf, color) != 0;
+ sprintf (buf, "#%04x%04x%04x", r, g, b);
+ success_p = pgtk_parse_color (f, buf, color) != 0;
#endif
#else
- GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
- GdkColor *grgb = get_bg
- ? &gsty->bg[GTK_STATE_SELECTED]
- : &gsty->fg[GTK_STATE_SELECTED];
+ gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
+ grgb = (get_bg ? &gsty->bg[GTK_STATE_SELECTED]
+ : &gsty->fg[GTK_STATE_SELECTED]);
- color->red = grgb->red;
- color->green = grgb->green;
- color->blue = grgb->blue;
- color->pixel = grgb->pixel;
- success_p = 1;
+ color->red = grgb->red;
+ color->green = grgb->green;
+ color->blue = grgb->blue;
+ color->pixel = grgb->pixel;
+ success_p = 1;
#endif
-
- }
unblock_input ();
return success_p;
}
static void
pgtk_set_child_frame_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
- int border = check_int_nonnegative (arg);
+ int border;
+
+ if (NILP (arg))
+ border = -1;
+ else if (RANGED_FIXNUMP (0, arg, INT_MAX))
+ border = XFIXNAT (arg);
+ else
+ signal_error ("Invalid child frame border width", arg);
if (border != FRAME_CHILD_FRAME_BORDER_WIDTH (f))
{
f->child_frame_border_width = border;
- if (FRAME_X_WINDOW (f))
+ if (FRAME_GTK_WIDGET (f))
{
- adjust_frame_size (f, -1, -1, 3, false, Qchild_frame_border_width);
+ adjust_frame_size (f, -1, -1, 3,
+ false, Qchild_frame_border_width);
pgtk_clear_under_internal_border (f);
}
}
if (gui_mouse_grabbed (dpyinfo)
&& (!EQ (track_mouse, Qdropping)
&& !EQ (track_mouse, Qdrag_source)))
- {
- /* 1.1. use last_mouse_frame as frame where the pointer is
- on. */
- f1 = dpyinfo->last_mouse_frame;
- }
+ f1 = dpyinfo->last_mouse_frame;
else
{
f1 = *fp;
- /* 1.2. get frame where the pointer is on. */
win = gtk_widget_get_window (FRAME_GTK_WIDGET (*fp));
seat = gdk_display_get_default_seat (dpyinfo->gdpy);
device = gdk_seat_get_pointer (seat);
return;
}
- /* 2. get the display and the device. */
win = gtk_widget_get_window (FRAME_GTK_WIDGET (f1));
- GdkDisplay *gdpy = gdk_window_get_display (win);
- seat = gdk_display_get_default_seat (gdpy);
+ seat = gdk_display_get_default_seat (dpyinfo->gdpy);
device = gdk_seat_get_pointer (seat);
- /* 3. get x, y relative to edit window of the frame. */
- win = gdk_window_get_device_position (win, device, &win_x, &win_y, &mask);
+ win = gdk_window_get_device_position (win, device,
+ &win_x, &win_y, &mask);
if (f1 != NULL)
{
- dpyinfo = FRAME_DISPLAY_INFO (f1);
- remember_mouse_glyph (f1, win_x, win_y, &dpyinfo->last_mouse_glyph);
+ remember_mouse_glyph (f1, win_x, win_y,
+ &dpyinfo->last_mouse_glyph);
dpyinfo->last_mouse_glyph_frame = f1;
*bar_window = Qnil;