Merge branch 'master' into broadway

This commit is contained in:
Alexander Larsson 2010-12-04 22:31:15 +01:00
commit 07fafe7b23
258 changed files with 40952 additions and 19368 deletions

47
NEWS
View File

@ -1,3 +1,50 @@
Overview of Changes from GTK+ 2.91.4 to 2.91.5
==============================================
* GtkSwitch: a new widget that provides switch-like on/off functionality
* Deprecations and cleanups:
- GtkCallbackMarshal and GtkFunction have been deprecated
- gtk_init_add has been removed
- The ::size-request signal has been removed
- GtkRuler has been removed
* The default value for the GtkBox::fill property has been changed
back to TRUE
* Bugs fixed:
613942 Deprecate GtkRuler, GtkVruler and GtkHRuler
629955 Deprecate / remove gtk_main and gtk_init_add / remove* API
633324 Stop invoking size-request completely
633896 Printing: Use XDG_DOCUMENTS_DIR as the default location...
634474 infinite loop in gtk_icon_view_accessible_set_adjustment
634558 Selecting "Search" should focus text box for keyboard entry
634592 GtkNotebook doesn't expand (in a typical GtkDialog)
634697 gdk: Add XSetting for "gtk-cursor-blink-timeout"
634821 Fix a BadMatch when create an icon pixmap for an ARGB visual
634987 add a switch widget
635175 Leak in gtk_plug_realize
635253 GtkRadioButton constructors don't mark group as "allow-none"
635307 iconcache: Ensure we don't lose data on power loss
635380 gdk_event_apply_filters is unsafe against changes in filter list
635588 clicking URL to be opened freezes the application for 3-5 seconds
635693 Bad pointer grab bug with GtkMenu/GtkComboBox
635879 Change the gdk_rgba_parse() function to be usable from bindings
* Updated translations:
Arabic
British English
Catalan
Czech
German
Hungarian
Indonesian
Norwegian bokmål
Romanian
Thai
Uyghur
Overview of Changes from GTK+ 2.91.3 to 2.91.4
==============================================

View File

@ -276,12 +276,6 @@
/* Whether to load modules via .la files rather than directly */
/* #undef USE_LA_MODULES */
/* Define to 1 if medialib is available and should be used */
/* #undef USE_MEDIALIB */
/* Define to 1 if medialib 2.5 is available */
/* #undef USE_MEDIALIB25 */
/* Define to 1 if XXM is available and should be used */
#ifndef _MSC_VER
# define USE_MMX 1

View File

@ -10,7 +10,7 @@
m4_define([gtk_major_version], [2])
m4_define([gtk_minor_version], [91])
m4_define([gtk_micro_version], [5])
m4_define([gtk_micro_version], [6])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@ -61,8 +61,8 @@ cflags_set=${CFLAGS+set}
AM_INIT_AUTOMAKE([1.10 no-define -Wno-portability dist-bzip2])
AM_MAINTAINER_MODE([enable])
# Support silent build rules, requires at least automake-1.11. Enable
# by either passing --enable-silent-rules to configure or passing V=0
# Support silent build rules, requires at least automake-1.11. Disable
# by either passing --disable-silent-rules to configure or passing V=1
# to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@ -861,28 +861,6 @@ AC_CHECK_HEADER(sys/sysinfo.h,
AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
[Define to 1 if sys/sysinfo.h is available]))
AC_MSG_CHECKING(for mediaLib 2.3)
use_mlib25=no
# Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
# patch requires.
AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
if test $use_mlib = yes; then
AC_DEFINE(USE_MEDIALIB, 1,
[Define to 1 if medialib is available and should be used])
MEDIA_LIB=-lmlib
AC_MSG_CHECKING(for mediaLib 2.5)
# Check for a mediaLib 2.5 function since that is what is needed for
# gdk_rgb_convert integration.
AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
if test $use_mlib25 = yes; then
AC_DEFINE(USE_MEDIALIB25, 1,
[Define to 1 if medialib 2.5 is available])
fi
fi
AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
@ -1495,6 +1473,25 @@ GLIB_GSETTINGS
GOBJECT_INTROSPECTION_CHECK([0.9.3])
##################################################
# Packagekit module
#################################################
AC_ARG_ENABLE(packagekit,
AC_HELP_STRING([--disable-packagekit],
[build packagekit open with module]))
ENABLE_PACKAGEKIT=
if test "os_win32" != "yes"; then
if test "x$enable_packagekit" != "xno"; then
ENABLE_PACKAGEKIT=1
AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable packagekit])
fi
fi
AC_SUBST(ENABLE_PACKAGEKIT)
AM_CONDITIONAL(ENABLE_PACKAGEKIT, test "x$ENABLE_PACKAGEKIT" = "x1")
##################################################
# Checks for gtk-doc and docbook-tools
##################################################

View File

@ -9,35 +9,37 @@
static GtkWidget *window = NULL;
static GtkWidget *da;
static GdkColor color;
static GdkRGBA color;
static GtkWidget *frame;
/* Expose callback for the drawing area
/* draw callback for the drawing area
*/
static gboolean
draw_callback (GtkWidget *widget,
draw_callback (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
GtkStyle *style;
GtkStyleContext *context;
GdkRGBA *bg;
style = gtk_widget_get_style (widget);
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
context = gtk_widget_get_style_context (widget);
gtk_style_context_get (context, 0, "background-color", &bg, NULL);
gdk_cairo_set_source_rgba (cr, bg);
cairo_paint (cr);
gdk_rgba_free (bg);
return TRUE;
}
static void
change_color_callback (GtkWidget *button,
gpointer data)
gpointer data)
{
GtkWidget *dialog;
GtkColorSelection *colorsel;
GtkColorSelectionDialog *selection_dialog;
gint response;
dialog = gtk_color_selection_dialog_new ("Changing color");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
@ -45,20 +47,19 @@ change_color_callback (GtkWidget *button,
selection_dialog = GTK_COLOR_SELECTION_DIALOG (dialog);
colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
gtk_color_selection_set_previous_color (colorsel, &color);
gtk_color_selection_set_current_color (colorsel, &color);
gtk_color_selection_set_previous_rgba (colorsel, &color);
gtk_color_selection_set_current_rgba (colorsel, &color);
gtk_color_selection_set_has_palette (colorsel, TRUE);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_OK)
{
gtk_color_selection_get_current_color (colorsel,
&color);
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
gtk_color_selection_get_current_rgba (colorsel, &color);
gtk_widget_override_background_color (da, 0, &color);
}
gtk_widget_destroy (dialog);
}
@ -68,20 +69,21 @@ do_colorsel (GtkWidget *do_widget)
GtkWidget *vbox;
GtkWidget *button;
GtkWidget *alignment;
if (!window)
{
color.red = 0;
color.blue = 65535;
color.blue = 1;
color.green = 0;
color.alpha = 1;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Color Selection");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
@ -92,33 +94,32 @@ do_colorsel (GtkWidget *do_widget)
/*
* Create the color swatch area
*/
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
da = gtk_drawing_area_new ();
g_signal_connect (da, "draw",
G_CALLBACK (draw_callback), NULL);
g_signal_connect (da, "draw", G_CALLBACK (draw_callback), NULL);
/* set a minimum size */
gtk_widget_set_size_request (da, 200, 200);
/* set the color */
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
gtk_widget_override_background_color (da, 0, &color);
gtk_container_add (GTK_CONTAINER (frame), da);
alignment = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);
button = gtk_button_new_with_mnemonic ("_Change the above color");
gtk_container_add (GTK_CONTAINER (alignment), button);
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
g_signal_connect (button, "clicked",
G_CALLBACK (change_color_callback), NULL);
G_CALLBACK (change_color_callback), NULL);
}
if (!gtk_widget_get_visible (window))

View File

@ -281,18 +281,18 @@ G_DEFINE_TYPE_WITH_CODE (MaskEntry, mask_entry, GTK_TYPE_ENTRY,
static void
mask_entry_set_background (MaskEntry *entry)
{
static const GdkColor error_color = { 0, 65535, 60000, 60000 };
static const GdkRGBA error_color = { 1.0, 0.9, 0.9, 1.0 };
if (entry->mask)
{
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
{
gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, &error_color);
gtk_widget_override_color (GTK_WIDGET (entry), 0, &error_color);
return;
}
}
gtk_widget_modify_base (GTK_WIDGET (entry), GTK_STATE_NORMAL, NULL);
gtk_widget_override_color (GTK_WIDGET (entry), 0, NULL);
}
@ -437,7 +437,26 @@ do_combobox (GtkWidget *do_widget)
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry);
/* A combobox with string IDs */
frame = gtk_frame_new ("String IDs");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box);
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible");
gtk_container_add (GTK_CONTAINER (box), combo);
entry = gtk_entry_new ();
g_object_bind_property (combo, "active-id",
entry, "text",
G_BINDING_BIDIRECTIONAL);
gtk_container_add (GTK_CONTAINER (box), entry);
}
if (!gtk_widget_get_visible (window))

View File

@ -751,7 +751,7 @@ create_text (GtkTextBuffer **buffer,
if (is_source)
{
font_desc = pango_font_description_from_string ("monospace");
gtk_widget_modify_font (text_view, font_desc);
gtk_widget_override_font (text_view, font_desc);
pango_font_description_free (font_desc);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),

View File

@ -230,7 +230,7 @@ gtk_rotated_bin_realize (GtkWidget *widget)
{
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
GtkAllocation allocation;
GtkStyle *style;
GtkStyleContext *context;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
@ -291,9 +291,9 @@ gtk_rotated_bin_realize (GtkWidget *widget)
G_CALLBACK (offscreen_window_from_parent), bin);
gtk_widget_style_attach (widget);
style = gtk_widget_get_style (widget);
gtk_style_set_background (style, window, GTK_STATE_NORMAL);
gtk_style_set_background (style, bin->offscreen_window, GTK_STATE_NORMAL);
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, window);
gtk_style_context_set_background (context, bin->offscreen_window);
gdk_window_show (bin->offscreen_window);
}
@ -542,12 +542,11 @@ gtk_rotated_bin_draw (GtkWidget *widget,
}
if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
{
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
widget, "blah",
0, 0,
gdk_window_get_width (bin->offscreen_window),
gdk_window_get_height (bin->offscreen_window));
gtk_render_background (gtk_widget_get_style_context (widget),
cr,
0, 0,
gdk_window_get_width (bin->offscreen_window),
gdk_window_get_height (bin->offscreen_window));
if (bin->child)
gtk_container_propagate_draw (GTK_CONTAINER (widget),
@ -575,7 +574,7 @@ do_offscreen_window (GtkWidget *do_widget)
if (!window)
{
GtkWidget *bin, *vbox, *scale, *button;
GdkColor black;
GdkRGBA black;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
@ -585,8 +584,8 @@ do_offscreen_window (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gdk_color_parse ("black", &black);
gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &black);
gdk_rgba_parse (&black, "black");
gtk_widget_override_background_color (window, 0, &black);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

View File

@ -168,7 +168,7 @@ gtk_mirror_bin_realize (GtkWidget *widget)
{
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
GtkAllocation allocation;
GtkStyle *style;
GtkStyleContext *context;
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
@ -229,9 +229,9 @@ gtk_mirror_bin_realize (GtkWidget *widget)
G_CALLBACK (offscreen_window_from_parent), bin);
gtk_widget_style_attach (widget);
style = gtk_widget_get_style (widget);
gtk_style_set_background (style, window, GTK_STATE_NORMAL);
gtk_style_set_background (style, bin->offscreen_window, GTK_STATE_NORMAL);
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, window);
gtk_style_context_set_background (context, bin->offscreen_window);
gdk_window_show (bin->offscreen_window);
}
@ -451,12 +451,11 @@ gtk_mirror_bin_draw (GtkWidget *widget,
}
else if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
{
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
widget, "blah",
0, 0,
gdk_window_get_width (bin->offscreen_window),
gdk_window_get_height (bin->offscreen_window));
gtk_render_background (gtk_widget_get_style_context (widget),
cr,
0, 0,
gdk_window_get_width (bin->offscreen_window),
gdk_window_get_height (bin->offscreen_window));
if (bin->child)
gtk_container_propagate_draw (GTK_CONTAINER (widget),

View File

@ -18,17 +18,17 @@ const char text[] = "I ♥ GTK+";
static void
fancy_shape_renderer (cairo_t *cr,
PangoAttrShape *attr,
gboolean do_path,
gpointer data)
PangoAttrShape *attr,
gboolean do_path,
gpointer data)
{
double x, y;
cairo_get_current_point (cr, &x, &y);
cairo_translate (cr, x, y);
cairo_scale (cr,
(double) attr->ink_rect.width / PANGO_SCALE,
(double) attr->ink_rect.height / PANGO_SCALE);
(double) attr->ink_rect.width / PANGO_SCALE,
(double) attr->ink_rect.height / PANGO_SCALE);
switch (GPOINTER_TO_UINT (attr->data))
{
@ -36,9 +36,9 @@ fancy_shape_renderer (cairo_t *cr,
{
cairo_move_to (cr, .5, .0);
cairo_line_to (cr, .9, -.4);
cairo_curve_to (cr, 1.1, -.8, .5, -.9, .5, -.5);
cairo_curve_to (cr, .5, -.9, -.1, -.8, .1, -.4);
cairo_close_path (cr);
cairo_curve_to (cr, 1.1, -.8, .5, -.9, .5, -.5);
cairo_curve_to (cr, .5, -.9, -.1, -.8, .1, -.4);
cairo_close_path (cr);
}
break;
}
@ -60,8 +60,8 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
/* Get font metrics and prepare fancy shape size */
metrics = pango_context_get_metrics (pango_layout_get_context (layout),
pango_layout_get_font_description (layout),
NULL);
pango_layout_get_font_description (layout),
NULL);
ascent = pango_font_metrics_get_ascent (metrics);
logical_rect.x = 0;
logical_rect.width = ascent;
@ -77,9 +77,9 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
PangoAttribute *attr;
attr = pango_attr_shape_new_with_data (&ink_rect,
&logical_rect,
GUINT_TO_POINTER (g_utf8_get_char (p)),
NULL, NULL);
&logical_rect,
GUINT_TO_POINTER (g_utf8_get_char (p)),
NULL, NULL);
attr->start_index = p - text;
attr->end_index = attr->start_index + strlen (HEART);
@ -93,7 +93,7 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
static gboolean
rotated_text_draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
gpointer data)
{
#define RADIUS 150
#define N_WORDS 5
@ -119,8 +119,8 @@ rotated_text_draw (GtkWidget *widget,
height = gtk_widget_get_allocated_height (widget);
device_radius = MIN (width, height) / 2.;
cairo_translate (cr,
device_radius + (width - 2 * device_radius) / 2,
device_radius + (height - 2 * device_radius) / 2);
device_radius + (width - 2 * device_radius) / 2,
device_radius + (height - 2 * device_radius) / 2);
cairo_scale (cr, device_radius / RADIUS, device_radius / RADIUS);
/* Create and a subtle gradient source and use it. */
@ -132,8 +132,8 @@ rotated_text_draw (GtkWidget *widget,
/* Create a PangoContext and set up our shape renderer */
context = gtk_widget_create_pango_context (widget);
pango_cairo_context_set_shape_renderer (context,
fancy_shape_renderer,
NULL, NULL);
fancy_shape_renderer,
NULL, NULL);
/* Create a PangoLayout, set the text, font, and attributes */
layout = pango_layout_new (context);
@ -181,11 +181,11 @@ do_rotated_text (GtkWidget *do_widget)
PangoLayout *layout;
PangoAttrList *attrs;
const GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
@ -200,10 +200,10 @@ do_rotated_text (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (box), drawing_area);
/* This overrides the background color from the theme */
gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, &white);
gtk_widget_override_background_color (drawing_area, 0, &white);
g_signal_connect (drawing_area, "draw",
G_CALLBACK (rotated_text_draw), NULL);
G_CALLBACK (rotated_text_draw), NULL);
/* And a label */
@ -215,8 +215,8 @@ do_rotated_text (GtkWidget *do_widget)
/* Set up fancy stuff on the label */
layout = gtk_label_get_layout (GTK_LABEL (label));
pango_cairo_context_set_shape_renderer (pango_layout_get_context (layout),
fancy_shape_renderer,
NULL, NULL);
fancy_shape_renderer,
NULL, NULL);
attrs = create_fancy_attr_list_for_layout (layout);
gtk_label_set_attributes (GTK_LABEL (label), attrs);
pango_attr_list_unref (attrs);

View File

@ -561,7 +561,7 @@ recursive_attach_view (int depth,
{
GtkWidget *child_view;
GtkWidget *event_box;
GdkColor color;
GdkRGBA color;
GtkWidget *align;
if (depth > 4)
@ -571,8 +571,8 @@ recursive_attach_view (int depth,
/* Event box is to add a black border around each child view */
event_box = gtk_event_box_new ();
gdk_color_parse ("black", &color);
gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, &color);
gdk_rgba_parse (&color, "black");
gtk_widget_override_background_color (event_box, 0, &color);
align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
gtk_container_set_border_width (GTK_CONTAINER (align), 1);

View File

@ -22,7 +22,6 @@
<xi:include href="xml/gdkdisplaymanager.xml" />
<xi:include href="xml/gdkscreen.xml" />
<xi:include href="xml/regions.xml" />
<xi:include href="xml/drawing.xml" />
<xi:include href="xml/colors.xml" />
<xi:include href="xml/rgba_colors.xml" />
<xi:include href="xml/visuals.xml" />

View File

@ -1,27 +1,4 @@
# GdkPixmap, GdkBitmap and GdkDrawable are the same as GdkWindow.
<STRUCT>
<NAME>GdkWindow</NAME>
struct GdkPixmap
{
gpointer user_data;
};
</STRUCT>
<STRUCT>
<NAME>GdkPixmap</NAME>
struct GdkPixmap
{
gpointer user_data;
};
</STRUCT>
<STRUCT>
<NAME>GdkDrawable</NAME>
struct GdkDrawable
{
gpointer user_data;
};
</STRUCT>
# GdkAtom is an opaque typedef
<STRUCT>
<NAME>GdkAtom</NAME>

View File

@ -257,6 +257,8 @@ gdk_color_to_string
<SUBSECTION Standard>
GDK_TYPE_COLOR
<SUBSECTION Private>
gdk_color_get_type
</SECTION>
<SECTION>
@ -272,25 +274,9 @@ gdk_rgba_to_string
<SUBSECTION Standard>
GDK_TYPE_RGBA
</SECTION>
<SECTION>
<TITLE>Drawing Primitives</TITLE>
<FILE>drawing</FILE>
GdkDrawable
gdk_drawable_get_clip_region
gdk_drawable_get_visible_region
<SUBSECTION Standard>
GDK_DRAWABLE
GDK_DRAWABLE_GET_CLASS
GDK_TYPE_DRAWABLE
GDK_IS_DRAWABLE
GDK_DRAWABLE_CLASS
GDK_IS_DRAWABLE_CLASS
<SUBSECTION Private>
GdkDrawableClass
gdk_rgba_get_type
</SECTION>
<SECTION>
@ -331,6 +317,7 @@ GDK_VISUAL_GET_CLASS
<SUBSECTION Private>
GdkVisualClass
GdkVisualPrivate
gdk_visual_get_type
</SECTION>
@ -339,7 +326,7 @@ gdk_visual_get_type
<FILE>windows</FILE>
GdkWindow
GdkWindowType
GdkWindowClass
GdkWindowWindowClass
GdkWindowHints
GdkGeometry
GdkGravity
@ -397,9 +384,11 @@ gdk_window_constrain_size
gdk_window_beep
<SUBSECTION>
gdk_window_get_clip_region
gdk_window_begin_paint_rect
gdk_window_begin_paint_region
gdk_window_end_paint
gdk_window_get_visible_region
<SUBSECTION>
gdk_window_invalidate_rect
@ -524,12 +513,12 @@ GDK_TYPE_WM_DECORATION
GDK_TYPE_WM_FUNCTION
<SUBSECTION Private>
gdk_window_object_get_type
gdk_drawable_get_type
gdk_window_get_type
gdk_window_window_class_get_type
GdkWindowObject
GdkWindowObjectClass
GdkWindowClass
GdkWindowImpl
GdkWindowImplIface
GdkWindowImplClass
GdkWindowRedirect
gdk_window_impl_get_type
gdk_window_freeze_toplevel_updates_libgtk_only
@ -616,7 +605,6 @@ gdk_cairo_set_source_pixbuf
gdk_cairo_set_source_window
gdk_cairo_rectangle
gdk_cairo_region
gdk_cairo_reset_clip
gdk_cairo_region_create_from_surface
</SECTION>
@ -733,6 +721,7 @@ gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
gdk_device_get_n_axes
gdk_device_get_n_keys
<SUBSECTION>
gdk_device_grab
@ -862,7 +851,6 @@ GdkNativeWindow
GdkEventDND
GdkEventProximity
GdkEventClient
GdkEventNoExpose
GdkEventWindowState
GdkEventSetting
GdkEventOwnerChange
@ -966,17 +954,13 @@ gdk_drag_context_get_type
<TITLE>X Window System Interaction</TITLE>
<FILE>x_interaction</FILE>
GDK_ROOT_WINDOW
GDK_WINDOW_XDISPLAY
GDK_WINDOW_XID
GDK_DISPLAY_XDISPLAY
GDK_DRAWABLE_XDISPLAY
GDK_DRAWABLE_XID
GDK_SCREEN_XDISPLAY
GDK_SCREEN_XNUMBER
GDK_SCREEN_XSCREEN
GDK_CURSOR_XCURSOR
GDK_CURSOR_XDISPLAY
GDK_WINDOW_XWINDOW
gdkx_visual_get
gdk_window_foreign_new
gdk_window_foreign_new_for_display
@ -998,6 +982,7 @@ gdk_x11_cursor_get_xcursor
gdk_x11_cursor_get_xdisplay
gdk_x11_display_broadcast_startup_message
gdk_x11_display_get_startup_notification_id
gdk_x11_display_set_startup_notification_id
gdk_x11_display_get_xdisplay
gdk_x11_display_grab
gdk_x11_display_ungrab
@ -1006,8 +991,7 @@ gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_register_standard_event_type
gdk_x11_drawable_get_xdisplay
gdk_x11_drawable_get_xid
gdk_x11_window_get_xid
gdk_x11_get_default_root_xwindow
gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay
@ -1028,7 +1012,6 @@ gdk_x11_get_xatom_name_for_display
<SUBSECTION Private>
GDK_HAVE_WCHAR_H
GDK_HAVE_WCTYPE_H
gdk_x11_window_get_drawable_impl
</SECTION>
<SECTION>

View File

@ -3,8 +3,7 @@
gdk_display_get_type
gdk_display_manager_get_type
gdk_screen_get_type
gdk_drawable_get_type
gdk_window_object_get_type
gdk_window_get_type
gdk_keymap_get_type
gdk_device_get_type
gdk_device_manager_get_type

View File

@ -22,6 +22,8 @@ CFILE_GLOB=$(top_srcdir)/gtk/*.c
# Header files to ignore when scanning
IGNORE_HFILES= \
fnmatch.h \
gtk9slice.h \
gtkanimationdescription.h \
gtkdebug.h \
gtkbuilderprivate.h \
gtkdndcursors.h \
@ -77,6 +79,7 @@ IGNORE_HFILES= \
gtktexttagprivate.h \
gtktexttypes.h \
gtktextutil.h \
gtktimeline.h \
gtkthemes.h \
gtktrayicon.h \
gtktreedatalist.h \
@ -122,6 +125,7 @@ content_files = \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-GtkApplication.xml \
migrating-GtkStyleContext.xml \
objects_grouped.sgml \
osx.sgml \
question_index.sgml \
@ -144,6 +148,7 @@ expand_content_files = \
migrating-2to3.xml \
migrating-checklist.sgml \
migrating-GtkApplication.xml \
migrating-GtkStyleContext.xml \
question_index.sgml \
text_widget.sgml \
tree_widget.sgml
@ -322,7 +327,32 @@ HTML_IMAGES = \
$(srcdir)/images/layout-tblr.png \
$(srcdir)/images/layout-tbrl.png \
$(srcdir)/images/window-default.png \
$(srcdir)/images/hello-world.png
$(srcdir)/images/hello-world.png \
$(srcdir)/images/switch.png
$(srcdir)/images/linear.png \
$(srcdir)/images/ease.png \
$(srcdir)/images/ease-in-out.png \
$(srcdir)/images/ease-in.png \
$(srcdir)/images/ease-out.png \
$(srcdir)/images/gradient1.png \
$(srcdir)/images/gradient2.png \
$(srcdir)/images/gradient3.png \
$(srcdir)/images/gradient4.png \
$(srcdir)/images/border1.png \
$(srcdir)/images/border2.png \
$(srcdir)/images/border3.png \
$(srcdir)/images/slices.png \
$(srcdir)/images/checks.png \
$(srcdir)/images/options.png \
$(srcdir)/images/arrows.png \
$(srcdir)/images/expanders.png \
$(srcdir)/images/background.png \
$(srcdir)/images/frames.png \
$(srcdir)/images/frame-gap.png \
$(srcdir)/images/sliders.png \
$(srcdir)/images/focus.png \
$(srcdir)/images/handles.png \
$(srcdir)/images/extensions.png
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=--extra-dir=../gdk/html \

View File

@ -3,6 +3,8 @@
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
@ -38,19 +40,31 @@
<xi:include href="xml/gtkaccelmap.xml" />
<xi:include href="xml/gtkclipboard.xml" />
<xi:include href="xml/gtkdnd.xml" />
<xi:include href="xml/gtkicontheme.xml" />
<xi:include href="xml/gtkstock.xml" />
<xi:include href="xml/gtkiconfactory.xml" />
<xi:include href="xml/gtkrc.xml" />
<xi:include href="xml/gtksettings.xml" />
<xi:include href="xml/gtkbindings.xml" />
<xi:include href="xml/gtkenums.xml" />
<xi:include href="xml/gtkstyle.xml" />
<xi:include href="xml/gtkselection.xml" />
<xi:include href="xml/gtktesting.xml" />
<xi:include href="xml/filesystem.xml" />
</part>
<part id="theming">
<title>Theming in GTK+</title>
<xi:include href="xml/gtkstylecontext.xml" />
<xi:include href="xml/gtkcssprovider.xml" />
<xi:include href="xml/gtkstyleprovider.xml" />
<xi:include href="xml/gtkstyleproperties.xml" />
<xi:include href="xml/gtkthemingengine.xml" />
<xi:include href="xml/gtkwidgetpath.xml" />
<xi:include href="xml/gtksymboliccolor.xml" />
<xi:include href="xml/gtkgradient.xml" />
<xi:include href="xml/gtkicontheme.xml" />
<xi:include href="xml/gtkiconfactory.xml" />
<xi:include href="xml/gtkrc.xml" />
<xi:include href="xml/gtkstyle.xml" />
</part>
<part id="gtkobjects">
<title>GTK+ Widgets and Objects</title>
@ -97,6 +111,7 @@
<xi:include href="xml/gtklinkbutton.xml" />
<xi:include href="xml/gtkscalebutton.xml" />
<xi:include href="xml/gtkvolumebutton.xml" />
<xi:include href="xml/gtkswitch.xml" />
</chapter>
<chapter id="NumericEntry">
@ -286,13 +301,6 @@
<xi:include href="xml/gtksocket.xml" />
</chapter>
<chapter id="SpecialObjects">
<title>Special-purpose features</title>
<xi:include href="xml/gtkruler.xml" />
<xi:include href="xml/gtkhruler.xml" />
<xi:include href="xml/gtkvruler.xml" />
</chapter>
<chapter id="RecentDocuments">
<title>Recently Used Documents</title>
<xi:include href="xml/gtkrecentmanager.xml" />
@ -303,6 +311,14 @@
<xi:include href="xml/gtkrecentfilter.xml" />
</chapter>
<chapter id="ApplicationChoosing">
<title>Choosing from installed applications</title>
<xi:include href="xml/gtkappchooser.xml" />
<xi:include href="xml/gtkappchooserbutton.xml" />
<xi:include href="xml/gtkappchooserdialog.xml" />
<xi:include href="xml/gtkappchooserwidget.xml" />
</chapter>
<chapter id="Builder">
<title>Interface builder</title>
<xi:include href="xml/gtkbuildable.xml" />
@ -331,6 +347,7 @@
<xi:include href="xml/migrating-checklist.sgml" />
<xi:include href="xml/migrating-2to3.xml" />
<xi:include href="xml/migrating-GtkApplication.xml" />
<xi:include href="xml/migrating-GtkStyleContext.xml" />
</part>
<part>

View File

@ -801,6 +801,10 @@ gtk_combo_box_get_active
gtk_combo_box_set_active
gtk_combo_box_get_active_iter
gtk_combo_box_set_active_iter
gtk_combo_box_get_id_column
gtk_combo_box_set_id_column
gtk_combo_box_get_active_id
gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popup_for_device
@ -840,9 +844,12 @@ gtk_combo_box_get_type
GtkComboBoxText
gtk_combo_box_text_new
gtk_combo_box_text_new_with_entry
gtk_combo_box_text_append
gtk_combo_box_text_prepend
gtk_combo_box_text_insert
gtk_combo_box_text_append_text
gtk_combo_box_text_insert_text
gtk_combo_box_text_prepend_text
gtk_combo_box_text_insert_text
gtk_combo_box_text_remove
gtk_combo_box_text_remove_all
gtk_combo_box_text_get_active_text
@ -874,6 +881,7 @@ gtk_container_set_resize_mode
gtk_container_check_resize
gtk_container_foreach
gtk_container_get_children
gtk_container_get_path_for_child
gtk_container_set_reallocate_redraws
gtk_container_get_focus_child
gtk_container_set_focus_child
@ -4838,6 +4846,11 @@ gtk_widget_input_shape_combine_region
gtk_widget_path
gtk_widget_class_path
gtk_widget_get_composite_name
gtk_widget_override_background_color
gtk_widget_override_color
gtk_widget_override_font
gtk_widget_override_symbolic_color
gtk_widget_override_cursor
gtk_widget_modify_style
gtk_widget_get_modifier_style
gtk_widget_modify_fg
@ -4846,11 +4859,11 @@ gtk_widget_modify_text
gtk_widget_modify_base
gtk_widget_modify_font
gtk_widget_modify_cursor
gtk_widget_modify_symbolic_color
gtk_widget_create_pango_context
gtk_widget_get_pango_context
gtk_widget_create_pango_layout
gtk_widget_render_icon
gtk_widget_render_icon_pixbuf
gtk_widget_pop_composite_child
gtk_widget_push_composite_child
gtk_widget_queue_draw_area
@ -4925,6 +4938,9 @@ gtk_widget_is_sensitive
gtk_widget_get_state
gtk_widget_get_visible
gtk_widget_set_visible
gtk_widget_set_state_flags
gtk_widget_unset_state_flags
gtk_widget_get_state_flags
gtk_widget_has_default
gtk_widget_has_focus
gtk_widget_has_grab
@ -4943,6 +4959,11 @@ gtk_widget_get_mapped
gtk_widget_get_requisition
gtk_widget_device_is_shadowed
<SUBSECTION>
gtk_widget_get_path
gtk_widget_get_style_context
gtk_widget_reset_style
<SUBSECTION>
gtk_requisition_new
gtk_requisition_copy
@ -5239,6 +5260,319 @@ GTK_INTERFACE_AGE
GTK_CHECK_VERSION
</SECTION>
<SECTION>
<FILE>gtkwidgetpath</FILE>
<TITLE>GtkWidgetPath</TITLE>
GtkWidgetPath
gtk_widget_path_append_type
gtk_widget_path_copy
gtk_widget_path_free
gtk_widget_path_get_widget_type
gtk_widget_path_has_parent
gtk_widget_path_is_type
gtk_widget_path_iter_add_class
gtk_widget_path_iter_add_region
gtk_widget_path_iter_clear_classes
gtk_widget_path_iter_clear_regions
gtk_widget_path_iter_get_name
gtk_widget_path_iter_get_widget_type
gtk_widget_path_iter_has_class
gtk_widget_path_iter_has_name
gtk_widget_path_iter_has_qclass
gtk_widget_path_iter_has_qname
gtk_widget_path_iter_has_qregion
gtk_widget_path_iter_has_region
gtk_widget_path_iter_list_classes
gtk_widget_path_iter_list_regions
gtk_widget_path_iter_remove_class
gtk_widget_path_iter_remove_region
gtk_widget_path_iter_set_name
gtk_widget_path_iter_set_widget_type
gtk_widget_path_length
gtk_widget_path_new
gtk_widget_path_prepend_type
</SECTION>
<SECTION>
<FILE>gtkstyleprovider</FILE>
<TITLE>GtkStyleProvider</TITLE>
GtkStyleProviderIface
GtkStyleProvider
GTK_STYLE_PROVIDER_PRIORITY_FALLBACK
GTK_STYLE_PROVIDER_PRIORITY_THEME
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
GTK_STYLE_PROVIDER_PRIORITY_USER
gtk_style_provider_get_icon_factory
gtk_style_provider_get_style
gtk_style_provider_get_style_property
<SUBSECTION Standard>
GTK_TYPE_STYLE_PROVIDER
GTK_STYLE_PROVIDER
GTK_IS_STYLE_PROVIDER
GTK_STYLE_PROVIDER_GET_IFACE
<SUBSECTION Private>
gtk_style_provider_get_type
</SECTION>
<SECTION>
<FILE>gtkstyleproperties</FILE>
<TITLE>GtkStyleProperties</TITLE>
GtkStyleProperties
gtk_style_properties_clear
gtk_style_properties_get
gtk_style_properties_get_property
gtk_style_properties_get_valist
gtk_style_properties_lookup_color
gtk_style_properties_lookup_property
gtk_style_properties_map_color
gtk_style_properties_merge
gtk_style_properties_new
GtkStylePropertyParser
gtk_style_properties_register_property
gtk_style_properties_set
gtk_style_properties_set_property
gtk_style_properties_set_valist
gtk_style_properties_unset_property
<SUBSECTION Standard>
GTK_TYPE_STYLE_PROPERTIES
GTK_IS_STYLE_PROPERTIES
GTK_IS_STYLE_PROPERTIES_CLASS
GTK_STYLE_PROPERTIES
GTK_STYLE_PROPERTIES_CLASS
GTK_STYLE_PROPERTIES_GET_CLASS
<SUBSECTION Private>
gtk_style_properties_get_type
</SECTION>
<SECTION>
<FILE>gtkstylecontext</FILE>
<TITLE>GtkStyleContext</TITLE>
<SUBSECTION>
GTK_STYLE_PROPERTY_BACKGROUND_COLOR
GTK_STYLE_PROPERTY_COLOR
GTK_STYLE_PROPERTY_FONT
GTK_STYLE_PROPERTY_MARGIN
GTK_STYLE_PROPERTY_PADDING
GTK_STYLE_PROPERTY_BORDER_WIDTH
GTK_STYLE_PROPERTY_BORDER_RADIUS
GTK_STYLE_PROPERTY_BORDER_STYLE
GTK_STYLE_PROPERTY_BORDER_COLOR
GTK_STYLE_PROPERTY_BACKGROUND_IMAGE
<SUBSECTION>
GTK_STYLE_CLASS_BACKGROUND
GTK_STYLE_CLASS_BUTTON
GTK_STYLE_CLASS_CALENDAR
GTK_STYLE_CLASS_CELL
GTK_STYLE_CLASS_CHECK
GTK_STYLE_CLASS_DEFAULT
GTK_STYLE_CLASS_ENTRY
GTK_STYLE_CLASS_HEADER
GTK_STYLE_CLASS_MENU
GTK_STYLE_CLASS_RADIO
GTK_STYLE_CLASS_RUBBERBAND
GTK_STYLE_CLASS_SCROLLBAR
GTK_STYLE_CLASS_SLIDER
GTK_STYLE_CLASS_TOOLTIP
GTK_STYLE_CLASS_TROUGH
GTK_STYLE_CLASS_ACCELERATOR
GTK_STYLE_CLASS_DOCK
GTK_STYLE_CLASS_GRIP
GTK_STYLE_CLASS_MENUBAR
GTK_STYLE_CLASS_MENUITEM
GTK_STYLE_CLASS_PROGRESSBAR
GTK_STYLE_CLASS_SPINNER
GTK_STYLE_CLASS_TOOLBAR
GTK_STYLE_REGION_COLUMN
GTK_STYLE_REGION_COLUMN_HEADER
GTK_STYLE_REGION_ROW
GTK_STYLE_REGION_TAB
<SUBSECTION>
GtkStyleContext
gtk_style_context_new
gtk_style_context_add_provider
gtk_style_context_add_provider_for_screen
gtk_style_context_get
gtk_style_context_get_direction
gtk_style_context_get_junction_sides
gtk_style_context_get_path
gtk_style_context_get_property
gtk_style_context_get_screen
gtk_style_context_get_state
gtk_style_context_get_style
gtk_style_context_get_style_property
gtk_style_context_get_style_valist
gtk_style_context_get_valist
gtk_style_context_get_color
gtk_style_context_get_background_color
gtk_style_context_get_border_color
gtk_style_context_get_border
gtk_style_context_get_padding
gtk_style_context_get_margin
gtk_style_context_invalidate
gtk_style_context_state_is_running
gtk_style_context_lookup_color
gtk_style_context_lookup_icon_set
gtk_style_context_notify_state_change
gtk_style_context_pop_animatable_region
gtk_style_context_push_animatable_region
gtk_style_context_remove_provider
gtk_style_context_remove_provider_for_screen
gtk_style_context_reset_widgets
gtk_style_context_set_background
gtk_style_context_restore
gtk_style_context_save
gtk_style_context_set_direction
gtk_style_context_set_junction_sides
gtk_style_context_set_path
gtk_style_context_add_class
gtk_style_context_remove_class
gtk_style_context_has_class
gtk_style_context_list_classes
gtk_style_context_add_region
gtk_style_context_remove_region
gtk_style_context_has_region
gtk_style_context_list_regions
gtk_style_context_set_screen
gtk_style_context_set_state
<SUBSECTION>
GtkBorder
gtk_border_new
gtk_border_copy
gtk_border_free
<SUBSECTION>
gtk_render_arrow
gtk_render_background
gtk_render_check
gtk_render_expander
gtk_render_extension
gtk_render_focus
gtk_render_frame
gtk_render_frame_gap
gtk_render_handle
gtk_render_layout
gtk_render_line
gtk_render_option
gtk_render_slider
gtk_render_activity
gtk_render_icon_pixbuf
<SUBSECTION Standard>
GTK_TYPE_STYLE_CONTEXT
GTK_STYLE_CONTEXT
GTK_STYLE_CONTEXT_CLASS
GTK_STYLE_CONTEXT_GET_CLASS
GTK_IS_STYLE_CONTEXT
GTK_IS_STYLE_CONTEXT_CLASS
GTK_TYPE_BORDER
<SUBSECTION Private>
gtk_style_context_get_type
gtk_border_get_type
</SECTION>
<SECTION>
<FILE>gtkcssprovider</FILE>
<TITLE>GtkCssProvider</TITLE>
GtkCssProvider
gtk_css_provider_get_default
gtk_css_provider_get_named
gtk_css_provider_load_from_data
gtk_css_provider_load_from_file
gtk_css_provider_load_from_path
gtk_css_provider_new
GTK_CSS_PROVIDER_ERROR
GtkCssProviderError
<SUBSECTION Standard>
GTK_TYPE_CSS_PROVIDER
GTK_CSS_PROVIDER
GTK_CSS_PROVIDER_CLASS
GTK_CSS_PROVIDER_GET_CLASS
GTK_IS_CSS_PROVIDER
GTK_IS_CSS_PROVIDER_CLASS
<SUBSECTION Private>
gtk_css_provider_get_type
gtk_css_provider_error_quark
</SECTION>
<SECTION>
<FILE>gtkthemingengine</FILE>
<TITLE>GtkThemingEngine</TITLE>
GtkThemingEngineClass
GtkThemingEngine
gtk_theming_engine_get
gtk_theming_engine_get_direction
gtk_theming_engine_get_junction_sides
gtk_theming_engine_get_path
gtk_theming_engine_get_property
gtk_theming_engine_get_screen
gtk_theming_engine_get_state
gtk_theming_engine_get_style
gtk_theming_engine_get_style_property
gtk_theming_engine_get_style_valist
gtk_theming_engine_get_valist
gtk_theming_engine_get_color
gtk_theming_engine_get_background_color
gtk_theming_engine_get_border_color
gtk_theming_engine_get_border
gtk_theming_engine_get_padding
gtk_theming_engine_get_margin
gtk_theming_engine_has_class
gtk_theming_engine_has_region
gtk_theming_engine_lookup_color
gtk_theming_engine_state_is_running
gtk_theming_engine_load
gtk_theming_engine_register_property
<SUBSECTION Standard>
GTK_THEMING_ENGINE
GTK_THEMING_ENGINE_CLASS
GTK_THEMING_ENGINE_GET_CLASS
GTK_IS_THEMING_ENGINE
GTK_IS_THEMING_ENGINE_CLASS
<SUBSECTION Private>
GTK_TYPE_THEMING_ENGINE
gtk_theming_engine_get_type
</SECTION>
<SECTION>
<FILE>gtksymboliccolor</FILE>
<TITLE>GtkSymbolicColor</TITLE>
GtkSymbolicColor
gtk_symbolic_color_new_literal
gtk_symbolic_color_new_name
gtk_symbolic_color_new_shade
gtk_symbolic_color_new_alpha
gtk_symbolic_color_new_mix
gtk_symbolic_color_ref
gtk_symbolic_color_unref
gtk_symbolic_color_resolve
<SUBSECTION Standard>
GTK_TYPE_SYMBOLIC_COLOR
<SUBSECTION Private>
gtk_symbolic_color_get_type
</SECTION>
<SECTION>
<FILE>gtkgradient</FILE>
<TITLE>GtkGradient</TITLE>
GtkGradient
gtk_gradient_new_linear
gtk_gradient_new_radial
gtk_gradient_add_color_stop
gtk_gradient_ref
gtk_gradient_unref
gtk_gradient_resolve
<SUBSECTION Standard>
GTK_TYPE_GRADIENT
gtk_gradient_get_type
</SECTION>
<SECTION>
<FILE>gtkstyle</FILE>
<TITLE>GtkStyle</TITLE>
@ -5278,12 +5612,6 @@ gtk_paint_layout
gtk_paint_resize_grip
gtk_draw_insertion_cursor
<SUBSECTION>
GtkBorder
gtk_border_new
gtk_border_copy
gtk_border_free
<SUBSECTION>
GtkRcProperty
GtkRcPropertyParser
@ -5296,10 +5624,8 @@ GTK_TYPE_STYLE
GTK_STYLE_CLASS
GTK_IS_STYLE_CLASS
GTK_STYLE_GET_CLASS
GTK_TYPE_BORDER
<SUBSECTION Private>
gtk_style_get_type
gtk_border_get_type
GtkThemeEngine
</SECTION>
@ -5549,12 +5875,16 @@ GtkScrollType
GtkSelectionMode
GtkShadowType
GtkStateType
GtkStateFlags
GtkToolbarStyle
GtkUpdateType
GtkWindowPosition
GtkWindowType
GtkSortType
GtkDragResult
GtkJunctionSides
GtkBorderStyle
GtkRegionFlags
<SUBSECTION Private>
GTK_PATH_PRIO_MASK
@ -5716,6 +6046,7 @@ gtk_icon_info_get_builtin_pixbuf
gtk_icon_info_load_icon
gtk_icon_info_load_symbolic
gtk_icon_info_load_symbolic_for_style
gtk_icon_info_load_symbolic_for_context
gtk_icon_info_set_raw_coordinates
gtk_icon_info_get_embedded_rect
gtk_icon_info_get_attach_points
@ -5757,6 +6088,7 @@ gtk_icon_set_new
gtk_icon_set_new_from_pixbuf
gtk_icon_set_ref
gtk_icon_set_render_icon
gtk_icon_set_render_icon_pixbuf
gtk_icon_set_unref
gtk_icon_size_lookup
gtk_icon_size_lookup_for_settings
@ -6382,3 +6714,120 @@ GTK_GRID_GET_CLASS
GtkGridPrivate
gtk_grid_get_type
</SECTION>
<SECTION>
<FILE>gtkswitch</FILE>
GtkSwitch
gtk_switch_new
gtk_switch_set_active
gtk_switch_get_active
<SUBSECTION Standard>
GtkSwitchClass
GTK_TYPE_SWITCH
GTK_SWITCH
GTK_SWITCH_CLASS
GTK_IS_SWITCH
GTK_IS_SWITCH_CLASS
GTK_SWITCH_GET_CLASS
<SUBSECTION Private>
GtkSwitchPrivate
gtk_switch_get_type
</SECTION>
<SECTION>
<FILE>gtkappchooser</FILE>
<TITLE>GtkAppChooser</TITLE>
GtkAppChooser
gtk_app_chooser_get_app_info
gtk_app_chooser_get_content_type
gtk_app_chooser_refresh
<SUBSECTION Standard>
GTK_TYPE_APP_CHOOSER
GTK_APP_CHOOSER
GTK_IS_APP_CHOOSER
<SUBSECTION Private>
gtk_app_chooser_get_type
</SECTION>
<SECTION>
<FILE>gtkappchooserbutton</FILE>
<TITLE>GtkAppChooserButton</TITLE>
GtkAppChooserButton
gtk_app_chooser_button_new
gtk_app_chooser_button_append_custom_item
gtk_app_chooser_button_append_separator
gtk_app_chooser_button_set_active_custom_item
gtk_app_chooser_button_get_show_dialog_item
gtk_app_chooser_button_set_show_dialog_item
<SUBSECTION Standard>
GtkAppChooserButtonClass
GTK_TYPE_APP_CHOOSER_BUTTON
GTK_APP_CHOOSER_BUTTON
GTK_APP_CHOOSER_BUTTON_CLASS
GTK_IS_APP_CHOOSER_BUTTON
GTK_IS_APP_CHOOSER_BUTTON_CLASS
GTK_APP_CHOOSER_BUTTON_GET_CLASS
<SUBSECTION Private>
GtkAppChooserButtonPrivate
gtk_app_chooser_button_get_type
</SECTION>
<SECTION>
<FILE>gtkappchooserdialog</FILE>
<TITLE>GtkAppChooserDialog</TITLE>
GtkAppChooserDialog
gtk_app_chooser_dialog_new
gtk_app_chooser_dialog_new_for_content_type
gtk_app_chooser_dialog_get_widget
<SUBSECTION Standard>
GtkAppChooserDialogClass
GTK_TYPE_APP_CHOOSER_DIALOG
GTK_APP_CHOOSER_DIALOG
GTK_APP_CHOOSER_DIALOG_CLASS
GTK_IS_APP_CHOOSER_DIALOG
GTK_IS_APP_CHOOSER_DIALOG_CLASS
GTK_APP_CHOOSER_DIALOG_GET_CLASS
<SUBSECTION Private>
GtkAppChooserDialogPrivate
gtk_app_chooser_dialog_get_type
</SECTION>
<SECTION>
<FILE>gtkappchooserwidget</FILE>
<TITLE>GtkAppChooserWidget</TITLE>
GtkAppChooserWidget
gtk_app_chooser_widget_new
gtk_app_chooser_widget_set_show_default
gtk_app_chooser_widget_get_show_default
gtk_app_chooser_widget_set_show_recommended
gtk_app_chooser_widget_get_show_recommended
gtk_app_chooser_widget_set_show_fallback
gtk_app_chooser_widget_get_show_fallback
gtk_app_chooser_widget_set_show_other
gtk_app_chooser_widget_get_show_other
gtk_app_chooser_widget_set_show_all
gtk_app_chooser_widget_get_show_all
gtk_app_chooser_widget_set_default_text
gtk_app_chooser_widget_get_default_text
<SUBSECTION Standard>
GtkAppChooserWidgetClass
GTK_TYPE_APP_CHOOSER_WIDGET
GTK_APP_CHOOSER_WIDGET
GTK_APP_CHOOSER_WIDGET_CLASS
GTK_IS_APP_CHOOSER_WIDGET
GTK_IS_APP_CHOOSER_WIDGET_CLASS
GTK_APP_CHOOSER_WIDGET_GET_CLASS
<SUBSECTION Private>
GtkAppChooserWidgetPrivate
gtk_app_chooser_widget_get_type
</SECTION>

View File

@ -11,6 +11,10 @@ gtk_action_group_get_type
gtk_activatable_get_type
gtk_adjustment_get_type
gtk_alignment_get_type
gtk_app_chooser_get_type
gtk_app_chooser_button_get_type
gtk_app_chooser_dialog_get_type
gtk_app_chooser_widget_get_type
gtk_application_get_type
gtk_arrow_get_type
gtk_aspect_frame_get_type
@ -43,6 +47,7 @@ gtk_color_selection_get_type
gtk_combo_box_get_type
gtk_combo_box_text_get_type
gtk_container_get_type
gtk_css_provider_get_type
gtk_dialog_get_type
gtk_drawing_area_get_type
gtk_editable_get_type
@ -66,7 +71,6 @@ gtk_handle_box_get_type
gtk_hbox_get_type
gtk_hbutton_box_get_type
gtk_hpaned_get_type
gtk_hruler_get_type
gtk_hscale_get_type
gtk_hscrollbar_get_type
gtk_hseparator_get_type
@ -121,7 +125,6 @@ gtk_recent_chooser_dialog_get_type
gtk_recent_chooser_menu_get_type
gtk_recent_chooser_widget_get_type
gtk_recent_manager_get_type
gtk_ruler_get_type
gtk_scale_button_get_type
gtk_scale_get_type
gtk_scrollable_get_type
@ -137,7 +140,10 @@ gtk_spin_button_get_type
gtk_spinner_get_type
gtk_statusbar_get_type
gtk_status_icon_get_type
gtk_switch_get_type
gtk_style_get_type
gtk_style_context_get_type
gtk_style_provider_get_type
gtk_table_get_type
gtk_tearoff_menu_item_get_type
gtk_text_buffer_get_type
@ -147,6 +153,7 @@ gtk_text_mark_get_type
gtk_text_tag_get_type
gtk_text_tag_table_get_type
gtk_text_view_get_type
gtk_theming_engine_get_type
gtk_toggle_action_get_type
gtk_toggle_button_get_type
gtk_toggle_tool_button_get_type
@ -171,7 +178,6 @@ gtk_vbutton_box_get_type
gtk_viewport_get_type
gtk_volume_button_get_type
gtk_vpaned_get_type
gtk_vruler_get_type
gtk_vscale_get_type
gtk_vscrollbar_get_type
gtk_vseparator_get_type

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -134,7 +134,7 @@
them, are gone. This includes the <literal>gdk_draw</literal> family
of functions like gdk_draw_rectangle() and gdk_draw_drawable(). As
#GdkGC is roughly equivalent to #cairo_t and #GdkImage was used for
drawing images to GdkDrawables, which cairo supports automatically,
drawing images to GdkWindows, which cairo supports automatically,
a transition is usually straightforward.
</para>
<para>
@ -143,7 +143,7 @@
was replaced.
</para>
<example>
<title>Drawing a GdkPixbuf onto a GdkDrawable</title>
<title>Drawing a GdkPixbuf onto a GdkWindow</title>
<para>
Drawing a pixbuf onto a drawable used to be done like this:
<programlisting><![CDATA[
@ -170,7 +170,7 @@ cairo_destroy (cr);
</para>
</example>
<example>
<title>Drawing a tiled GdkPixmap to a GdkDrawable</title>
<title>Drawing a tiled GdkPixmap to a GdkWindow</title>
<para>
Tiled pixmaps are often used for drawing backgrounds.
Old code looked something like this:

View File

@ -13,7 +13,7 @@
longer correct to assume that each window has an associated XID.
Code that makes this assumption can sometimes be fixed by calling
gdk_window_ensure_native() on the windows in question.
Calling gdk_x11_drawable_get_xid() (or GDK_WINDOW_XID()) from the
Calling gdk_x11_window_get_xid() (or GDK_WINDOW_XID()) from the
X11-specific API on a non-native window will explicitly call
gdk_window_ensure_native(), so old code using this will continue to
work. A small gotcha is that the GDK_WINDOW_XID() call is no longer a
@ -46,15 +46,9 @@
<para>
Problems can also occur when using cairo for drawing. One thing that can
go wrong is clip handling. If you ever need to reset the clip region on
a cairo_t (i.e. use cairo_reset_clip()), you have to to use
gdk_cairo_reset_clip() instead. The reason for this is that the cairo_reset_clip() call will remove the initial clip region that limits your drawing to
the client-side window at hand, so you will end up drawing over stuff
outside the window. You also need to use gdk_cairo_reset_clip() if you
use a cairo_t that was not allocated in a double-buffered expose handler
and keep it in use after window hierarchy changes (resizing, moving,
stacking order changes). The easiest fix for this kind of problem is to
simply create a new cairo context for each expose event.
go wrong is clip handling. You may not use cairo_reset_clip() on a
cairo_t on a cairo context created via gdk_cairo_create() or passed to
the GtkWidget::draw signal.
</para>
<para>

View File

@ -0,0 +1,631 @@
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-GtkStyleContext">
<title>Migrating from GtkStyle to GtkStyleContext</title>
<para>
In GTK+ 3.0, #GtkStyleContext was added to replace #GtkStyle and
the theming infrastructure available in 2.x. GtkStyleContext is an
object similar in spirit to GtkStyle, as it contains theming information,
although in a more complete and tokenized fashion. There are two aspects
to switching to GtkStyleContext: porting themes and theme engines, and
porting applications, libraries and widgets.
</para>
<refsect2 id="gtk-migrating-GtkStyleContext-themes">
<title>Migrating themes</title>
<para>
From GTK+ 3.0 on, theme engines must implement #GtkThemingEngine and be
installed in <filename>$libdir/gtk+-3.0/$GTK_VERSION/theming-engines</filename>,
and the files containing style information must be written in the CSS-like
format that is understood by #GtkCssProvider. For a theme named
"Clearlooks", the CSS file parsed by default is
<filename>$datadir/themes/Clearlooks/gtk-3.0/gtk.css</filename>,
with possible variants such as the dark theme being named
<filename>gtk-dark.css</filename> in the same directory.
</para>
</refsect2>
<refsect2 id="gtk-migrating-theme-GtkStyleContext-engines">
<title>Migrating theme engines</title>
<para>
Migrating a #GtkStyle based engine to a #GtkThemingEngine based one
should be straightforward for most of the vfuncs. Besides a cleanup
in the available paint methods and a simplification in the passed
arguments (in favor of #GtkStyleContext containing all the information),
the available render methods resemble those of #GtkStyle quite
evidently. Notable differences include:
</para>
<orderedlist>
<listitem>
All variations of gtk_paint_box(), gtk_paint_flat_box(),
gtk_paint_shadow(), gtk_paint_box_gap() and gtk_paint_shadow_gap()
are replaced by gtk_render_background(), gtk_render_frame() and
gtk_render_frame_gap(). The first function renders frameless
backgrounds and the last two render frames in various forms.
</listitem>
<listitem>
gtk_paint_resize_grip() has been subsumed by gtk_render_handle()
with a #GTK_STYLE_CLASS_GRIP class set in the style context.
</listitem>
<listitem>
gtk_paint_spinner() disappears in favor of gtk_render_activity()
with a #GTK_STYLE_CLASS_SPINNER class set in the style context.
</listitem>
</orderedlist>
<para>
The list of available render methods is:
</para>
<simplelist>
<member>
gtk_render_background(): Renders a widget/area background.
</member>
<member>
gtk_render_frame(): Renders a frame border around the given rectangle.
Usually the detail of the border depends on the theme information,
plus the current widget state.
</member>
<member>
gtk_render_frame_gap(): Renders a frame border with a gap on one side.
</member>
<member>
gtk_render_layout(): Renders a #PangoLayout.
</member>
<member>
gtk_render_handle(): Renders all kind of handles and resize grips,
depending on the style class.
</member>
<member>
gtk_render_check(): Render checkboxes.
</member>
<member>
gtk_render_option(): Render radiobuttons.
</member>
<member>
gtk_render_arrow(): Renders an arrow pointing to a direction.
</member>
<member>
gtk_render_expander(): Renders an expander indicator, such as in
#GtkExpander.
</member>
<member>
gtk_render_focus(): Renders the indication that a widget has the
keyboard focus.
</member>
<member>
gtk_render_line(): Renders a line from one coordinate to another.
</member>
<member>
gtk_render_slider(): Renders a slider, such as in #GtkScale.
</member>
<member>
gtk_render_extension(): Renders an extension that protrudes from
a UI element, such as a notebook tab.
</member>
<member>
gtk_render_activity(): Renders an area displaying activity, be it
a progressbar or a spinner.
</member>
<member>
gtk_render_icon_pixbuf(): Renders an icon into a #GdkPixbuf.
</member>
</simplelist>
<para>
One of the main differences to #GtkStyle-based engines is that the
rendered widget is totally isolated from the theme engine, all style
information is meant to be retrieved from the #GtkThemingEngine API,
or from the #GtkWidgetPath obtained from gtk_theming_engine_get_path(),
which fully represents the rendered widget's hierarchy from a styling
point of view.
</para>
<para>
The detail string available in #GtkStyle-based engines has been
replaced by widget regions and style classes. Regions are a way for
complex widgets to associate different styles with different areas,
such as even and odd rows in a treeview. Style classes allow sharing
of style information between widgets, regardless of their type.
Regions and style classes can be used in style sheets to associate
styles, and them engines can also access them. There are several
predefined classes and regions such as %GTK_STYLE_CLASS_BUTTON or
%GTK_STYLE_REGION_TAB in <filename>gtkstylecontext.h</filename>,
although custom widgets may define their own, which themes may
attempt to handle.
</para>
</refsect2>
<refsect2 id="gtk-migrating-GtkStyleContext-parser-extensions">
<title>Extending the CSS parser</title>
<para>
In #GtkStyle-based engines, #GtkRCStyle provided ways to extend the
gtkrc parser with engine-specific extensions. This has been replaced
by gtk_theming_engine_register_property(), which lets a theme engine
register new properties with an arbitrary type. While there is built-in
support for most basic types, it is possible to use a custom parser
for the property.
</para>
<para>
The installed properties depend on the #GtkThemeEngine::name property,
so they should be added in the <literal>constructed()</literal> vfunc.
For example, if an engine with the name "Clearlooks" installs a
"focus-color" property with the type #GdkRGBA, the property
<literal>-Clearlooks-focus-color</literal> will be registered and
accepted in CSS like this:
<informalexample><programlisting>
GtkEntry {
-Clearlooks-focus-color: rgba(255, 0, 0, 1.0);
}
</programlisting></informalexample>
</para>
<para>
Widget style properties also follow a similar syntax, with the widget
type name used as a prefix. For example, the #GtkWidget:focus-line-width
style property can be modified in CSS as
<literal>-GtkWidget-focus-line-width</literal>.
</para>
</refsect2>
<refsect2 id="gtk-migrating-GtkStyleContext-css">
<title>Using the CSS file format</title>
<para>
The syntax of RC and CSS files formats is obviously different.
The CSS-like syntax will hopefully be much more familiar to many
people, lowering the barrier for custom theming.
</para>
<para>
Instead of going through the syntax differences one-by-one, we
will present a more or less comprehensive example and discuss
how it can be translated into CSS:
</para>
<example>
<title>Sample RC code</title>
<programlisting>
style "default" {
xthickness = 1
ythickness = 1
GtkButton::child-displacement-x = 1
GtkButton::child-displacement-y = 1
GtkCheckButton::indicator-size = 14
bg[NORMAL] = @bg_color
bg[PRELIGHT] = shade (1.02, @bg_color)
bg[SELECTED] = @selected_bg_color
bg[INSENSITIVE] = @bg_color
bg[ACTIVE] = shade (0.9, @bg_color)
fg[NORMAL] = @fg_color
fg[PRELIGHT] = @fg_color
fg[SELECTED] = @selected_fg_color
fg[INSENSITIVE] = darker (@bg_color)
fg[ACTIVE] = @fg_color
text[NORMAL] = @text_color
text[PRELIGHT] = @text_color
text[SELECTED] = @selected_fg_color
text[INSENSITIVE] = darker (@bg_color)
text[ACTIVE] = @selected_fg_color
base[NORMAL] = @base_color
base[PRELIGHT] = shade (0.95, @bg_color)
base[SELECTED] = @selected_bg_color
base[INSENSITIVE] = @bg_color
base[ACTIVE] = shade (0.9, @selected_bg_color)
engine "clearlooks" {
colorize_scrollbar = TRUE
style = CLASSIC
}
}
style "tooltips" {
xthickness = 4
ythickness = 4
bg[NORMAL] = @tooltip_bg_color
fg[NORMAL] = @tooltip_fg_color
}
style "button" {
xthickness = 3
ythickness = 3
bg[NORMAL] = shade (1.04, @bg_color)
bg[PRELIGHT] = shade (1.06, @bg_color)
bg[ACTIVE] = shade (0.85, @bg_color)
}
style "entry" {
xthickness = 3
ythickness = 3
bg[SELECTED] = mix (0.4, @selected_bg_color, @base_color)
fg[SELECTED] = @text_color
engine "clearlooks" {
focus_color = shade (0.65, @selected_bg_color)
}
}
style "other" {
bg[NORMAL] = &num;fff;
}
class "GtkWidget" style "default"
class "GtkEntry" style "entry"
widget_class "*&lt;GtkButton&gt;" style "button"
widget "gtk-tooltip*" style "tooltips"
widget_class "window-name.*.GtkButton" style "other"
</programlisting>
</example>
<para>
would roughly translate to this CSS:
</para>
<example>
<title>CSS translation</title>
<programlisting>
* {
padding: 1;
-GtkButton-child-displacement-x: 1;
-GtkButton-child-displacement-y: 1;
-GtkCheckButton-indicator-size: 14;
background-color: @bg_color;
color: @fg_color;
-Clearlooks-colorize-scrollbar: true;
-Clearlooks-style: classic;
}
*:hover {
background-color: shade (@bg_color, 1.02);
}
*:selected {
background-color: @selected_bg_color;
color: @selected_fg_color;
}
*:insensitive {
color: shade (@bg_color, 0.7);
}
*:active {
background-color: shade (@bg_color, 0.9);
}
.tooltip {
padding: 4;
background-color: @tooltip_bg_color;
color: @tooltip_fg_color;
}
.button {
padding: 3;
background-color: shade (@bg_color, 1.04);
}
.button:hover {
background-color: shade (@bg_color, 1.06);
}
.button:active {
background-color: shade (@bg_color, 0.85);
}
.entry {
padding: 3;
background-color: @base_color;
color: @text_color;
}
.entry:selected {
background-color: mix (@selected_bg_color, @base_color, 0.4);
-Clearlooks-focus-color: shade (0.65, @selected_bg_color)
}
/* The latter selector is an specification of the first,
since any widget may use the same classes or names */
&num;window-name .button,
GtkWindow&num;window-name GtkButton.button {
background-color: &num;fff;
}
</programlisting>
</example>
<para>
One notable difference is the reduction from fg/bg/text/base colors
to only foreground/background, in exchange the widget is able to render
its various elements with different CSS classes, which can be themed
independently.
</para>
<para>
Access to colors has also changed a bit. With #GtkStyle, the common
way to access colors is:
<informalexample><programlisting>
GdkColor *color1;
GdkColor color2;
color1 = &amp;style->bg[GTK_STATE_PRELIGHT];
gtk_style_lookup_color (style, "focus_color", &amp;color2);
</programlisting></informalexample>
With #GtkStyleContext, you generally use #GdkRGBA instead of #GdkColor
and the code looks like this:
<informalexample><programlisting>
GdkRGBA *color1;
GdkRGBA color2;
gtk_style_context_get (context, GTK_STATE_FLAG_PRELIGHT,
"background-color", &amp;color1,
NULL);
gtk_style_context_lookup_color (context, "focus_color", &amp;color2);
...
gdk_rgba_free (color1);
</programlisting></informalexample>
Note that the memory handling here is different: gtk_style_context_get()
expects the address of a GdkRGBA* and returns a newly allocated struct,
gtk_style_context_lookup_color() expects the address of an existing
struct, and fills it.
</para>
<para>
It is worth mentioning that the new file format does not support
custom keybindings nor stock icon mappings as the RC format did.
</para>
</refsect2>
<refsect2 id="gtk-migrating-GtkStyleContext-checklist">
<title>A checklist for widgets</title>
<para>
When porting your widgets to use #GtkStyleContext, this checklist
might be useful.
</para>
<orderedlist>
<listitem>
Replace <literal>style_set()</literal> calls with
<literal>style_updated()</literal>.
</listitem>
<listitem>
<para>
Try to identify the role of what you're rendering with any number
of classes. This will replace the detail string. There is a predefined
set of CSS classes which you can reuse where appropriate. Doing so
will give you theming 'for free', whereas custom classes will require
extra work in the theme. Note that complex widgets are likely to
need different styles when rendering different parts, and style
classes are one way to achieve this. This could result in code like
the following (simplified) examples:
</para>
<example>
<title>Setting a permanent CSS class</title>
<programlisting>
static void
gtk_button_init (GtkButton *button)
{
GtkStyleContext *context;
...
context = gtk_widget_get_style_context (GTK_WIDGET (button));
/* Set the "button" class */
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
}
</programlisting>
</example>
<para>
Or
</para>
<example>
<title>Using dynamic CSS classes for different elements</title>
<programlisting>
static gboolean
gtk_spin_button_draw (GtkSpinButton *spin,
cairo_t *cr)
{
GtkStyleContext *context;
...
context = gtk_widget_get_style_context (GTK_WIDGET (spin));
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_ENTRY);
/* Call to entry draw impl with "entry" class */
parent_class->draw (spin, cr);
gtk_style_context_restore (context);
gtk_style_context_save (context);
/* Render up/down buttons with the "button" class */
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
draw_up_button (spin, cr);
draw_down_button (spin, cr);
gtk_style_context_restore (context);
...
}
</programlisting>
</example>
<para>
Note that #GtkStyleContext only provides fg/bg colors, so text/base
is done through distinctive theming of the different classes. For
example, an entry would usually be black on white while a button
would usually be black on light grey.
</para>
</listitem>
<listitem>
Replace all <literal>gtk_paint_*()</literal> calls with corresponding
<literal>gtk_render_*()</literal> calls. The most distinctive changes
are the use of #GtkStateFlags to represent the widget state and the
lack of #GtkShadowType. For gtk_render_check() and gtk_render_option(),
the @shadow_type parameter is replaced by the #GTK_STATE_FLAG_ACTIVE
and #GTK_STATE_FLAG_INCONSISTENT state flags. For things such as
pressed/unpressed button states, #GTK_STATE_FLAG_ACTIVE is used, and
the CSS may style normal/active states differently to render
outset/inset borders, respectively.
</listitem>
<listitem>
The various <literal>gtk_widget_modify_*()</literal> functions to
override colors or fonts for individual widgets have been replaced
by similar <literal>gtk_widget_override_*()</literal> functions.
</listitem>
<listitem>
It is no longer necessary to call gtk_widget_style_attach(),
gtk_style_attach(), gtk_style_detach() or gtk_widget_ensure_style().
</listitem>
<listitem>
Replace all uses of xthickness/ythickness. #GtkStyleContext uses the
CSS box model, and there are border-width/padding/margin properties to
replace the different applications of X and Y thickness. Note that all
of this is merely a guideline. Widgets may choose to follow it or not.
</listitem>
</orderedlist>
</refsect2>
<refsect2 id="gtk-migrating-GtkStyleContext-parsing">
<title>Parsing of custom resources</title>
<para>
As a consequence of the RC format going away, calling gtk_rc_parse() or
gtk_rc_parse_string() won't have any effect on a widgets appearance.
The way to replace these calls is using a custom #GtkStyleProvider,
either for an individual widget through gtk_style_context_add_provider()
or for all widgets on a screen through gtk_style_context_add_provider_for_screen().
Typically, the provider will be a #GtkCssProvider, which parse CSS
information from a file or from a string.
</para>
<para>
Notice that you can also get style information from custom resources
by implementing the #GtkStyleProvider interface yourself. This is
an advanced feature that should be rarely used.
</para>
</refsect2>
<refsect2 id="gtk-migrating-GtkStyleContext-bonus-points">
<title>Bonus points</title>
<para>
There are some features in #GtkStyleContext that were not available in
#GtkStyle, or were made available over time for certain widgets through
extending the detail string in obscure ways. There is a lot more
information available when rendering UI elements, and it is accessible
in more uniform, less hacky ways. By going through this list you'll
ensure your widget is a good citizen in a fully themable user interface.
</para>
<orderedlist>
<listitem>
If your widget renders a series of similar elements, such as tabs
in a #GtkNotebook or rows/column in a #GtkTreeView, consider adding
regions through gtk_style_context_add_region(). These regions can be
referenced in CSS and the :nth-child pseudo-class may be used to match
the elements depending on the flags passed.
<example>
<title>Theming widget regions</title>
<programlisting>
GtkNotebook tab {
background-color: &num;f3329d;
}
GtkTreeView row::nth-child (even) {
background-color: &num;dddddd;
}
</programlisting>
</example>
</listitem>
<listitem>
<para>
If your container renders child widgets within different regions,
make it implement GtkContainer::get_path_for_child(). This function
lets containers assign a special #GtkWidgetPath to child widgets
depending on their role/region. This is necessary to extend the
concept above throughout the widget hierarchy.
</para>
<para>
For example, a #GtkNotebook modifies the tab labels' #GtkWidgetPath
so the "tab" region is added. This makes it possible to theme tab
labels through:
</para>
<example>
<title>Theming a widget within a parent container region</title>
<programlisting>
GtkNotebook tab GtkLabel {
font: Sans 8;
}
</programlisting>
</example>
</listitem>
<listitem>
If you intend several visual elements to look interconnected,
make sure you specify rendered elements' connection areas with
gtk_style_context_set_junction_sides(). It is of course up to the
theme to make use of this information or not.
</listitem>
<listitem>
<para>
#GtkStyleContext supports implicit animations on state changes for
the most simple case out-of-the-box: widgets with a single animatable
area, whose state is changed with gtk_widget_set_state_flags() or
gtk_widget_unset_state_flags(). These functions trigger animated
transitions for the affected state flags. Examples of widgets for
which this kind of animation may be sufficient are #GtkButton or
#GtkEntry.
</para>
<para>
If your widget consists of more than a simple area, and these areas
may be rendered with different states, make sure to mark the rendered
areas with gtk_style_context_push_animatable_region() and
gtk_style_context_pop_animatable_region().
</para>
<para>
gtk_style_context_notify_state_change() may be used to trigger a
transition for a given state. The region ID will determine the
animatable region that is affected by this transition.
</para>
</listitem>
</orderedlist>
</refsect2>
</chapter>

View File

@ -30,20 +30,8 @@ toggles the value.
<!-- ##### STRUCT GtkCheckMenuItem ##### -->
<para>
The #GtkCheckMenuItem-struct struct contains the following fields.
(These fields should be considered read-only. They should never be set by
an application.)
<informaltable pgwide="1" frame="none" role="struct">
<tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/>
<tbody>
<row>
<entry>#guint active;</entry>
<entry>TRUE if the check box is active.</entry>
</row>
</tbody></tgroup></informaltable>
The #GtkCheckMenuItem-struct struct contains only private fields that
should not be directly accessed.
</para>
@ -53,8 +41,8 @@ This signal is emitted when the state of the check box is changed.
</para>
<para>
A signal handler can examine the <structfield>active</structfield>
field of the #GtkCheckMenuItem-struct struct to discover the new state.
A signal handler can use gtk_check_menu_item_get_active()
to discover the new state.
</para>
@checkmenuitem: the object which received the signal.

View File

@ -315,19 +315,28 @@ Used to change the appearance of an outline typically provided by a #GtkFrame.
<!-- ##### ENUM GtkStateType ##### -->
<para>
This type indicates the current state of a widget; the state determines how
the widget is drawn. The #GtkStateType enumeration is also used to
identify different colors in a #GtkStyle for drawing, so states can be
used for subparts of a widget as well as entire widgets.
</para>
@GTK_STATE_NORMAL: State during normal operation.
@GTK_STATE_ACTIVE: State of a currently active widget, such as a depressed button.
@GTK_STATE_PRELIGHT: State indicating that the mouse pointer is over
the widget and the widget will respond to mouse clicks.
@GTK_STATE_SELECTED: State of a selected item, such the selected row in a list.
@GTK_STATE_INSENSITIVE: State indicating that the widget is
unresponsive to user actions.
@GTK_STATE_NORMAL:
@GTK_STATE_ACTIVE:
@GTK_STATE_PRELIGHT:
@GTK_STATE_SELECTED:
@GTK_STATE_INSENSITIVE:
@GTK_STATE_INCONSISTENT:
@GTK_STATE_FOCUSED:
<!-- ##### ENUM GtkStateFlags ##### -->
<para>
</para>
@GTK_STATE_FLAG_ACTIVE:
@GTK_STATE_FLAG_PRELIGHT:
@GTK_STATE_FLAG_SELECTED:
@GTK_STATE_FLAG_INSENSITIVE:
@GTK_STATE_FLAG_INCONSISTENT:
@GTK_STATE_FLAG_FOCUSED:
<!-- ##### ENUM GtkToolbarStyle ##### -->
<para>
@ -411,3 +420,39 @@ The value can by obtained by connecting to the
@GTK_DRAG_RESULT_ERROR: The drag operation failed due to some
unspecified error
<!-- ##### ENUM GtkJunctionSides ##### -->
<para>
</para>
@GTK_JUNCTION_NONE:
@GTK_JUNCTION_CORNER_TOPLEFT:
@GTK_JUNCTION_CORNER_TOPRIGHT:
@GTK_JUNCTION_CORNER_BOTTOMLEFT:
@GTK_JUNCTION_CORNER_BOTTOMRIGHT:
@GTK_JUNCTION_TOP:
@GTK_JUNCTION_BOTTOM:
@GTK_JUNCTION_LEFT:
@GTK_JUNCTION_RIGHT:
<!-- ##### ENUM GtkBorderStyle ##### -->
<para>
</para>
@GTK_BORDER_STYLE_NONE:
@GTK_BORDER_STYLE_SOLID:
@GTK_BORDER_STYLE_INSET:
@GTK_BORDER_STYLE_OUTSET:
<!-- ##### ENUM GtkRegionFlags ##### -->
<para>
</para>
@GTK_REGION_EVEN:
@GTK_REGION_ODD:
@GTK_REGION_FIRST:
@GTK_REGION_LAST:
@GTK_REGION_SORTED:

View File

@ -279,6 +279,17 @@ This attribute is optional.</para>
@Returns:
<!-- ##### FUNCTION gtk_icon_set_render_icon_pixbuf ##### -->
<para>
</para>
@icon_set:
@context:
@size:
@Returns:
<!-- ##### FUNCTION gtk_icon_set_unref ##### -->
<para>

View File

@ -449,6 +449,18 @@ The #GQuark used for #GtkIconThemeError errors.
@Returns:
<!-- ##### FUNCTION gtk_icon_info_load_symbolic_for_context ##### -->
<para>
</para>
@icon_info:
@context:
@was_symbolic:
@error:
@Returns:
<!-- ##### FUNCTION gtk_icon_info_set_raw_coordinates ##### -->
<para>

View File

@ -10,6 +10,10 @@ GTK+ provides resource file mechanism for configuring
various aspects of the operation of a GTK+ program
at runtime.
</para>
<para>
In GTK+ 3.0, resource files have been deprecated and replaced
by CSS-like style sheets, which are understood by #GtkCssProvider.
</para>
<refsect2><title>Default files</title>
<para>

View File

@ -123,4 +123,7 @@
<link linkend="GtkFileChooserDialog">
<inlinegraphic fileref="filechooser.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkSwitch">
<inlinegraphic fileref="switch.png" format="PNG"></inlinegraphic>
</link>
</para>

View File

@ -224,7 +224,7 @@ int main (int argc, char **argv)
gtk_main_iteration ();
}
id = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
id = gdk_x11_window_get_xid (window);
screenshot = take_window_shot (id, info->include_decorations);
filename = g_strdup_printf ("./%s.png", info->name);
gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);

View File

@ -115,6 +115,7 @@ new_widget_info (const char *name,
else
{
info->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_has_resize_grip (GTK_WINDOW (info->window), FALSE);
info->include_decorations = FALSE;
gtk_widget_show_all (widget);
gtk_container_add (GTK_CONTAINER (info->window), widget);
@ -159,6 +160,26 @@ create_button (void)
return new_widget_info ("button", align, SMALL);
}
static WidgetInfo *
create_switch (void)
{
GtkWidget *widget;
GtkWidget *align;
GtkWidget *sw;
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
sw = gtk_switch_new ();
gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
sw = gtk_switch_new ();
gtk_box_pack_start (GTK_BOX (widget), sw, TRUE, TRUE, 0);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), widget);
return new_widget_info ("switch", align, SMALL);
}
static WidgetInfo *
create_toggle_button (void)
{
@ -1095,6 +1116,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_page_setup_dialog ());
retval = g_list_prepend (retval, create_print_dialog ());
retval = g_list_prepend (retval, create_volume_button ());
retval = g_list_prepend (retval, create_switch ());
return retval;
}

View File

@ -21,7 +21,6 @@ EXTRA_DIST += \
gdkkeysyms-update.pl \
gdk.def \
gdkmarshalers.list \
gdkmedialib.h \
gdkwindowimpl.h \
makeenums.pl \
makefile.msc \
@ -55,13 +54,6 @@ LDADD = \
$(no_undefined) \
$(LIBTOOL_EXPORT_OPTIONS)
if USE_MEDIALIB
medialib_sources = \
gdkmedialib.c
else
medialib_sources =
endif
#
# setup source file variables
#
@ -79,7 +71,6 @@ gdk_public_h_sources = \
gdkdisplay.h \
gdkdisplaymanager.h \
gdkdnd.h \
gdkdrawable.h \
gdkevents.h \
gdkinput.h \
gdkkeys.h \
@ -111,7 +102,6 @@ gdk_private_headers = \
gdkpoly-generic.h
gdk_c_sources = \
$(medialib_sources) \
gdk.c \
gdkapplaunchcontext.c \
gdkcairo.c \
@ -122,7 +112,6 @@ gdk_c_sources = \
gdkdisplay.c \
gdkdisplaymanager.c \
gdkdnd.c \
gdkdraw.c \
gdkevents.c \
gdkglobals.c \
gdkkeys.c \
@ -206,7 +195,6 @@ x11_introspection_files = \
x11/gdkdevice-xi.c \
x11/gdkdisplay-x11.c \
x11/gdkdnd-x11.c \
x11/gdkdrawable-x11.c \
x11/gdkeventsource.c \
x11/gdkeventtranslator.c \
x11/gdkgeometry-x11.c \

View File

@ -38,7 +38,6 @@
#include <gdk/gdkdisplay.h>
#include <gdk/gdkdisplaymanager.h>
#include <gdk/gdkdnd.h>
#include <gdk/gdkdrawable.h>
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkinput.h>

View File

@ -22,7 +22,6 @@ gdk_cairo_get_clip_rectangle
gdk_cairo_rectangle
gdk_cairo_region
gdk_cairo_region_create_from_surface
gdk_cairo_reset_clip
gdk_cairo_set_source_color
gdk_cairo_set_source_pixbuf
gdk_cairo_set_source_rgba
@ -60,6 +59,7 @@ gdk_device_get_key
gdk_device_get_mode
gdk_device_get_name
gdk_device_get_n_axes
gdk_device_get_n_keys
gdk_device_get_source
gdk_device_get_state
gdk_device_get_type G_GNUC_CONST
@ -153,9 +153,6 @@ gdk_drag_get_selection
gdk_drag_motion
gdk_drag_protocol_get_type G_GNUC_CONST
gdk_drag_status
gdk_drawable_get_clip_region
gdk_drawable_get_type G_GNUC_CONST
gdk_drawable_get_visible_region
gdk_drop_finish
gdk_drop_reply
gdk_enable_multidevice
@ -372,6 +369,7 @@ gdk_visual_get_system
gdk_visual_get_type G_GNUC_CONST
gdk_visual_get_visual_type
gdk_visual_type_get_type G_GNUC_CONST
#ifdef GDK_WINDOWING_WIN32
gdk_win32_drawable_get_handle
gdk_win32_handle_table_lookup
gdk_win32_icon_to_pixbuf_libgtk_only
@ -379,6 +377,7 @@ gdk_win32_pixbuf_to_hicon_libgtk_only
gdk_win32_selection_add_targets
gdk_win32_set_modal_dialog_libgtk_only
gdk_win32_window_is_win32
#endif
gdk_window_add_filter
gdk_window_at_pointer
gdk_window_attributes_type_get_type G_GNUC_CONST
@ -387,7 +386,7 @@ gdk_window_begin_move_drag
gdk_window_begin_paint_rect
gdk_window_begin_paint_region
gdk_window_begin_resize_drag
gdk_window_class_get_type G_GNUC_CONST
gdk_window_class_class_get_type G_GNUC_CONST
gdk_window_configure_finished
gdk_window_constrain_size
gdk_window_coords_from_parent
@ -411,6 +410,7 @@ gdk_window_geometry_changed
gdk_window_get_accept_focus
gdk_window_get_background_pattern
gdk_window_get_children
gdk_window_get_clip_region
gdk_window_get_composited
gdk_window_get_cursor
gdk_window_get_decorations
@ -437,9 +437,11 @@ gdk_window_get_screen
gdk_window_get_state
gdk_window_get_support_multidevice
gdk_window_get_toplevel
gdk_window_get_type G_GNUC_CONST
gdk_window_get_type_hint
gdk_window_get_update_area
gdk_window_get_user_data
gdk_window_get_visible_region
gdk_window_get_visual
gdk_window_get_width
gdk_window_get_window_type
@ -468,7 +470,6 @@ gdk_window_move
gdk_window_move_region
gdk_window_move_resize
gdk_window_new
gdk_window_object_get_type G_GNUC_CONST
gdk_window_peek_children
gdk_window_process_all_updates
gdk_window_process_updates
@ -544,8 +545,6 @@ gdk_x11_display_grab
gdk_x11_display_set_cursor_theme
gdk_x11_display_set_startup_notification_id
gdk_x11_display_ungrab
gdk_x11_drawable_get_xdisplay
gdk_x11_drawable_get_xid
gdk_x11_get_default_root_xwindow
gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay
@ -565,7 +564,7 @@ gdk_x11_screen_lookup_visual
gdk_x11_screen_supports_net_wm_hint
gdk_x11_ungrab_server
gdk_x11_visual_get_xvisual
gdk_x11_window_get_drawable_impl
gdk_x11_window_get_xid
gdk_x11_window_move_to_current_desktop
gdk_x11_window_set_user_time
gdk_x11_xatom_to_atom

View File

@ -21,7 +21,6 @@
#include "gdkcairo.h"
#include "gdkdrawable.h"
#include "gdkinternals.h"
#include <math.h>
@ -42,70 +41,6 @@
*/
/**
* gdk_cairo_create:
* @drawable: a #GdkDrawable
*
* Creates a Cairo context for drawing to @drawable.
*
* <note><para>
* Note that due to double-buffering, Cairo contexts created
* in a GTK+ expose event handler cannot be cached and reused
* between different expose events.
* </para></note>
*
* Return value: A newly created Cairo context. Free with
* cairo_destroy() when you are done drawing.
*
* Since: 2.8
**/
cairo_t *
gdk_cairo_create (GdkDrawable *drawable)
{
cairo_surface_t *surface;
cairo_t *cr;
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
surface = _gdk_drawable_ref_cairo_surface (drawable);
cr = cairo_create (surface);
if (GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip)
GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr);
cairo_surface_destroy (surface);
return cr;
}
/**
* gdk_cairo_reset_clip:
* @cr: a #cairo_t
* @drawable: a #GdkDrawable
*
* Resets the clip region for a Cairo context created by gdk_cairo_create().
*
* This resets the clip region to the "empty" state for the given drawable.
* This is required for non-native windows since a direct call to
* cairo_reset_clip() would unset the clip region inherited from the
* drawable (i.e. the window clip region), and thus let you e.g.
* draw outside your window.
*
* This is rarely needed though, since most code just create a new cairo_t
* using gdk_cairo_create() each time they want to draw something.
*
* Since: 2.18
**/
void
gdk_cairo_reset_clip (cairo_t *cr,
GdkDrawable *drawable)
{
cairo_reset_clip (cr);
if (GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip)
GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr);
}
/**
* gdk_cairo_get_clip_rectangle:
* @cr: a cairo context
@ -149,7 +84,7 @@ gdk_cairo_get_clip_rectangle (cairo_t *cr,
* gdk_cairo_set_source_color:
* @cr: a #cairo_t
* @color: a #GdkColor
*
*
* Sets the specified #GdkColor as the source color of @cr.
*
* Since: 2.8
@ -167,6 +102,15 @@ gdk_cairo_set_source_color (cairo_t *cr,
color->blue / 65535.);
}
/**
* gdk_cairo_set_source_rgba:
* @cr: a #cairo_t
* @rgba: a #GdkRGBA
*
* Sets the specified #GdkRGBA as the source color of @cr.
*
* Since: 3.0
**/
void
gdk_cairo_set_source_rgba (cairo_t *cr,
const GdkRGBA *rgba)
@ -363,7 +307,7 @@ gdk_cairo_set_source_window (cairo_t *cr,
g_return_if_fail (cr != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (window));
surface = _gdk_window_ref_cairo_surface (window);
cairo_set_source_surface (cr, surface, x, y);
cairo_surface_destroy (surface);
}

View File

@ -31,9 +31,7 @@
G_BEGIN_DECLS
cairo_t *gdk_cairo_create (GdkDrawable *drawable);
void gdk_cairo_reset_clip (cairo_t *cr,
GdkDrawable *drawable);
cairo_t *gdk_cairo_create (GdkWindow *window);
gboolean gdk_cairo_get_clip_rectangle(cairo_t *cr,
GdkRectangle *rect);

View File

@ -1067,7 +1067,7 @@ gdk_device_grab (GdkDevice *device,
else
native = gdk_window_get_toplevel (window);
while (((GdkWindowObject *) native)->window_type == GDK_WINDOW_OFFSCREEN)
while (native->window_type == GDK_WINDOW_OFFSCREEN)
{
native = gdk_offscreen_window_get_embedder (native);
@ -1231,7 +1231,6 @@ _gdk_device_translate_window_coord (GdkDevice *device,
gdouble x_resolution, y_resolution;
gdouble device_aspect;
gint window_width, window_height;
GdkWindowObject *window_private;
priv = device->priv;
@ -1274,7 +1273,6 @@ _gdk_device_translate_window_coord (GdkDevice *device,
y_min = 0;
}
window_private = (GdkWindowObject *) window;
window_width = gdk_window_get_width (window);
window_height = gdk_window_get_height (window);
@ -1342,7 +1340,6 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
GdkDevicePrivate *priv = device->priv;
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
GdkWindowObject *window_private;
if (priv->mode != GDK_MODE_SCREEN)
return FALSE;
@ -1357,7 +1354,6 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
return FALSE;
axis_width = axis_info.max_value - axis_info.min_value;
window_private = (GdkWindowObject *) window;
if (axis_info.use == GDK_AXIS_X)
{
@ -1366,7 +1362,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
offset = - window_root_x - window_private->abs_x;
offset = - window_root_x - window->abs_x;
}
else
{
@ -1375,7 +1371,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
offset = - window_root_y - window_private->abs_y;
offset = - window_root_y - window->abs_y;
}
if (axis_value)

View File

@ -933,20 +933,17 @@ gdk_window_real_window_get_device_position (GdkDisplay *display,
gint *y,
GdkModifierType *mask)
{
GdkWindowObject *private;
gint tmpx, tmpy;
GdkModifierType tmp_mask;
gboolean normal_child;
private = (GdkWindowObject *) window;
normal_child = GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_device_state (window,
normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
device,
&tmpx, &tmpy,
&tmp_mask);
/* We got the coords on the impl, convert to the window */
tmpx -= private->abs_x;
tmpy -= private->abs_y;
tmpx -= window->abs_x;
tmpy -= window->abs_y;
if (x)
*x = tmpx;

View File

@ -1,123 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkdrawable.h"
#include "gdkcairo.h"
#include "gdkinternals.h"
#include "gdkwindow.h"
#include "gdkscreen.h"
#include "gdkpixbuf.h"
#include <pango/pangocairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <math.h>
G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
static void
gdk_drawable_class_init (GdkDrawableClass *klass)
{
}
static void
gdk_drawable_init (GdkDrawable *drawable)
{
}
/**
* gdk_drawable_get_clip_region:
* @drawable: a #GdkDrawable
*
* Computes the region of a drawable that potentially can be written
* to by drawing primitives. This region will not take into account
* the clip region for the GC, and may also not take into account
* other factors such as if the window is obscured by other windows,
* but no area outside of this region will be affected by drawing
* primitives.
*
* Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
* when you are done.
**/
cairo_region_t *
gdk_drawable_get_clip_region (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_clip_region (drawable);
}
/**
* gdk_drawable_get_visible_region:
* @drawable: a #GdkDrawable
*
* Computes the region of a drawable that is potentially visible.
* This does not necessarily take into account if the window is
* obscured by other windows, but no area outside of this region
* is visible.
*
* Returns: a #cairo_region_t. This must be freed with cairo_region_destroy()
* when you are done.
**/
cairo_region_t *
gdk_drawable_get_visible_region (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_visible_region (drawable);
}
/**
* _gdk_drawable_ref_cairo_surface:
* @drawable: a #GdkDrawable
*
* Obtains a #cairo_surface_t for the given drawable. If a
* #cairo_surface_t for the drawable already exists, it will be
* referenced, otherwise a new surface will be created.
*
* Return value: a newly referenced #cairo_surface_t that points
* to @drawable. Unref with cairo_surface_destroy()
**/
cairo_surface_t *
_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
return GDK_DRAWABLE_GET_CLASS (drawable)->ref_cairo_surface (drawable);
}
/************************************************************************/
cairo_surface_t *
_gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
int width,
int height)
{
return GDK_DRAWABLE_GET_CLASS (drawable)->create_cairo_surface (drawable,
width, height);
}

View File

@ -1,95 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_DRAWABLE_H__
#define __GDK_DRAWABLE_H__
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo.h>
G_BEGIN_DECLS
typedef struct _GdkDrawableClass GdkDrawableClass;
#define GDK_TYPE_DRAWABLE (gdk_drawable_get_type ())
#define GDK_DRAWABLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE, GdkDrawable))
#define GDK_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE, GdkDrawableClass))
#define GDK_IS_DRAWABLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE))
#define GDK_IS_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE))
#define GDK_DRAWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE, GdkDrawableClass))
/**
* GdkDrawable:
*
* An opaque structure representing an object that can be
* drawn onto.
*/
struct _GdkDrawable
{
GObject parent_instance;
};
struct _GdkDrawableClass
{
GObjectClass parent_class;
cairo_region_t* (*get_clip_region) (GdkDrawable *drawable);
cairo_region_t* (*get_visible_region) (GdkDrawable *drawable);
cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
void (*set_cairo_clip) (GdkDrawable *drawable,
cairo_t *cr);
cairo_surface_t * (*create_cairo_surface) (GdkDrawable *drawable,
int width,
int height);
/* Padding for future expansion */
void (*_gdk_reserved7) (void);
void (*_gdk_reserved9) (void);
void (*_gdk_reserved10) (void);
void (*_gdk_reserved11) (void);
void (*_gdk_reserved12) (void);
void (*_gdk_reserved13) (void);
void (*_gdk_reserved14) (void);
void (*_gdk_reserved15) (void);
};
GType gdk_drawable_get_type (void) G_GNUC_CONST;
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
G_END_DECLS
#endif /* __GDK_DRAWABLE_H__ */

View File

@ -59,9 +59,16 @@ struct _GdkIOClosure
/* Private variable declarations
*/
GdkEventFunc _gdk_event_func = NULL; /* Callback for events */
gpointer _gdk_event_data = NULL;
GDestroyNotify _gdk_event_notify = NULL;
static GdkEventFunc _gdk_event_func = NULL; /* Callback for events */
static gpointer _gdk_event_data = NULL;
static GDestroyNotify _gdk_event_notify = NULL;
void
_gdk_event_emit (GdkEvent *event)
{
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
}
/*********************************************
* Functions for maintaining the event queue *
@ -636,7 +643,6 @@ gdk_event_get_time (const GdkEvent *event)
return event->dnd.time;
case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
case GDK_NO_EXPOSE:
case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE:
case GDK_NOTHING:
@ -704,7 +710,6 @@ gdk_event_get_state (const GdkEvent *event,
return TRUE;
case GDK_VISIBILITY_NOTIFY:
case GDK_CLIENT_EVENT:
case GDK_NO_EXPOSE:
case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE:
case GDK_SELECTION_CLEAR:
@ -1435,7 +1440,7 @@ gdk_synthesize_window_state (GdkWindow *window,
temp_event.window_state.type = GDK_WINDOW_STATE;
temp_event.window_state.send_event = FALSE;
old = ((GdkWindowObject*) temp_event.window_state.window)->state;
old = temp_event.window_state.window->state;
temp_event.window_state.new_window_state = old;
temp_event.window_state.new_window_state |= set_flags;
@ -1450,7 +1455,7 @@ gdk_synthesize_window_state (GdkWindow *window,
* inconsistent state to the user.
*/
((GdkWindowObject*) window)->state = temp_event.window_state.new_window_state;
window->state = temp_event.window_state.new_window_state;
if (temp_event.window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN)
_gdk_window_update_viewable (window);
@ -1460,7 +1465,7 @@ gdk_synthesize_window_state (GdkWindow *window,
* Non-toplevels do use the GDK_WINDOW_STATE_WITHDRAWN flag
* internally so we needed to update window->state.
*/
switch (((GdkWindowObject*) window)->window_type)
switch (window->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP: /* ? */

View File

@ -77,7 +77,6 @@ G_BEGIN_DECLS
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GdkEventNoExpose GdkEventNoExpose;
typedef struct _GdkEventVisibility GdkEventVisibility;
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
@ -205,8 +204,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
* @GDK_CLIENT_EVENT: a message has been received from another application.
* @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
* @GDK_NO_EXPOSE: indicates that the source region was completely available
* when parts of a drawable were copied. This is not very useful.
* @GDK_SCROLL: the scroll wheel was turned
* @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
* for the possible window states
@ -258,7 +255,6 @@ typedef enum
GDK_DROP_FINISHED = 27,
GDK_CLIENT_EVENT = 28,
GDK_VISIBILITY_NOTIFY = 29,
GDK_NO_EXPOSE = 30,
GDK_SCROLL = 31,
GDK_WINDOW_STATE = 32,
GDK_SETTING = 33,
@ -465,23 +461,6 @@ struct _GdkEventExpose
gint count; /* If non-zero, how many more events follow. */
};
/**
* GdkEventNoExpose:
* @type: the type of the event (%GDK_NO_EXPOSE).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly (e.g. using
* <function>XSendEvent</function>).
*
* Generated when the area of a #GdkDrawable being copied was completely
* available.
*/
struct _GdkEventNoExpose
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
};
/**
* GdkEventVisibility:
* @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
@ -1064,7 +1043,6 @@ union _GdkEvent
GdkEventType type;
GdkEventAny any;
GdkEventExpose expose;
GdkEventNoExpose no_expose;
GdkEventVisibility visibility;
GdkEventMotion motion;
GdkEventButton button;

View File

@ -32,10 +32,8 @@
#include <gio/gio.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkwindowimpl.h>
#include <gdk/gdkprivate.h>
#ifdef USE_MEDIALIB
#include <gdk/gdkmedialib.h>
#endif
G_BEGIN_DECLS
@ -178,25 +176,20 @@ typedef struct
} GdkDeviceGrabInfo;
typedef struct _GdkInputWindow GdkInputWindow;
typedef struct _GdkWindowPaint GdkWindowPaint;
typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
GdkDevice *device,
GdkPointerWindowInfo *device_info,
gpointer user_data);
/* Private version of GdkWindowObject. The initial part of this strucuture
is public for historical reasons. Don't change that part */
typedef struct _GdkWindowPaint GdkWindowPaint;
#define GDK_WINDOW_OBJECT(object) ((GdkWindowObject *) GDK_WINDOW (object))
struct _GdkWindowObject
struct _GdkWindow
{
GdkDrawable parent_instance;
GObject parent_instance;
GdkDrawable *impl; /* window-system-specific delegate object */
GdkWindowImpl *impl; /* window-system-specific delegate object */
GdkWindowObject *parent;
GdkWindow *parent;
GdkVisual *visual;
gpointer user_data;
@ -238,10 +231,10 @@ struct _GdkWindowObject
guint update_and_descendants_freeze_count;
/* The GdkWindowObject that has the impl, ref:ed if another window.
/* The GdkWindow that has the impl, ref:ed if another window.
* This ref is required to keep the wrapper of the impl window alive
* for as long as any GdkWindow references the impl. */
GdkWindowObject *impl_window;
GdkWindow *impl_window;
int abs_x, abs_y; /* Absolute offset in impl */
gint width, height;
guint32 clip_tag;
@ -267,18 +260,13 @@ struct _GdkWindowObject
cairo_region_t *input_shape;
cairo_surface_t *cairo_surface;
guint outstanding_surfaces; /* only set on impl window */
GList *devices_inside;
GHashTable *device_events;
};
#define GDK_WINDOW_TYPE(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->window_type)
#define GDK_WINDOW_DESTROYED(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->destroyed)
extern GdkEventFunc _gdk_event_func; /* Callback for events */
extern gpointer _gdk_event_data;
extern GDestroyNotify _gdk_event_notify;
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
#define GDK_WINDOW_DESTROYED(d) (GDK_WINDOW (d)->destroyed)
extern GSList *_gdk_displays;
extern gchar *_gdk_display_name;
@ -289,6 +277,7 @@ extern gboolean _gdk_enable_multidevice;
void _gdk_events_queue (GdkDisplay *display);
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
void _gdk_event_emit (GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
GList *node);
@ -318,16 +307,13 @@ GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents);
cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
int width,
int height);
/*************************************
* Interfaces used by windowing code *
*************************************/
cairo_surface_t *
_gdk_window_ref_cairo_surface (GdkWindow *window);
void _gdk_window_impl_new (GdkWindow *window,
GdkWindow *real_parent,
GdkScreen *screen,
@ -367,9 +353,6 @@ gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
void _gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset);
cairo_region_t *_gdk_windowing_window_get_shape (GdkWindow *window);
cairo_region_t *_gdk_windowing_window_get_input_shape(GdkWindow *window);
void _gdk_windowing_window_beep (GdkWindow *window);
void _gdk_windowing_get_device_state (GdkDisplay *display,
@ -407,7 +390,7 @@ gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
gint depth);
#define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
#define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
/* Called when gdk_window_destroy() is called on a foreign window
@ -443,9 +426,6 @@ struct _GdkPaintableIface
GType _gdk_paintable_get_type (void) G_GNUC_CONST;
/* Implementation types */
GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
struct GdkAppLaunchContextPrivate
{
GdkDisplay *display;

View File

@ -1,120 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2001-2007 Sun Microsystems, Inc. All rights reserved.
* (Brian Cameron, Dmitriy Demin, James Cheng, Padraig O'Briain)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2007. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkmedialib.h"
#include <stdlib.h>
#include <dlfcn.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#if defined(HAVE_SYS_SYSTEMINFO_H)
#include <sys/systeminfo.h>
#elif defined(HAVE_SYS_SYSINFO_H)
#include <sys/sysinfo.h>
#endif
typedef char * (*ml_version) (void);
static ml_version medialib_version = mlib_version;
gboolean
_gdk_use_medialib (void)
{
char *mlib_version_string;
char sys_info[257];
long count;
/*
* Sun mediaLib(tm) support.
*
* http://www.sun.com/processors/vis/mlib.html
*
*/
if (getenv ("GDK_DISABLE_MEDIALIB"))
return FALSE;
/*
* The imaging functions we want to use were added in mediaLib version 2.
* So turn off mediaLib support if the user has an older version.
* mlib_version returns a string in this format:
*
* mediaLib:0210:20011101:v8plusa
* ^^^^^^^^ ^^^^ ^^^^^^^^ ^^^^^^^
* libname vers build ISALIST identifier
* date (in this case sparcv8plus+vis)
*
* The first 2 digits of the version are the major version. The 3rd digit
* is the minor version, and the 4th digit is the micro version. So the
* above string corresponds to version 2.1.0.In the following test we only
* care about the major version.
*/
mlib_version_string = medialib_version ();
count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
if (count != -1)
{
if (strcmp (sys_info, "i386") == 0)
{
char *mlib_target_isa = &mlib_version_string[23];
/*
* For x86 processors mediaLib generic C implementation
* does not give any performance advantage so disable it.
*/
if (strncmp (mlib_target_isa, "sse", 3) != 0)
{
return FALSE;
}
/*
* For x86 processors use of libumem conflicts with
* mediaLib, so avoid using it.
*/
if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
{
return FALSE;
}
}
}
else
{
/* Failed to get system architecture, disable mediaLib */
return FALSE;
}
return TRUE;
}

View File

@ -1,45 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2001-2007 Sun Microsystems, Inc. All rights reserved.
* (Brian Cameron, Dmitriy Demin, James Cheng, Padraig O'Briain)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_MEDIALIB_H__
#define __GDK_MEDIALIB_H__
#ifdef USE_MEDIALIB
#include <mlib_image.h>
#include <mlib_video.h>
#include <gdktypes.h>
G_BEGIN_DECLS
gboolean _gdk_use_medialib (void);
G_END_DECLS
#endif /* USE_MEDIALIB */
#endif /* __GDK_MEDIALIB_H__ */

View File

@ -44,7 +44,7 @@ typedef struct _GdkOffscreenWindowClass GdkOffscreenWindowClass;
struct _GdkOffscreenWindow
{
GdkDrawable parent_instance;
GdkWindowImpl parent_instance;
GdkWindow *wrapper;
@ -54,7 +54,7 @@ struct _GdkOffscreenWindow
struct _GdkOffscreenWindowClass
{
GdkDrawableClass parent_class;
GdkWindowImplClass parent_class;
};
#define GDK_TYPE_OFFSCREEN_WINDOW (gdk_offscreen_window_get_type())
@ -64,14 +64,9 @@ struct _GdkOffscreenWindowClass
#define GDK_IS_OFFSCREEN_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_OFFSCREEN_WINDOW))
#define GDK_OFFSCREEN_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_OFFSCREEN_WINDOW, GdkOffscreenWindowClass))
static void gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface);
static void gdk_offscreen_window_hide (GdkWindow *window);
G_DEFINE_TYPE_WITH_CODE (GdkOffscreenWindow,
gdk_offscreen_window,
GDK_TYPE_DRAWABLE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_WINDOW_IMPL,
gdk_offscreen_window_impl_iface_init));
G_DEFINE_TYPE (GdkOffscreenWindow, gdk_offscreen_window, GDK_TYPE_WINDOW_IMPL)
static void
@ -95,10 +90,9 @@ gdk_offscreen_window_destroy (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy)
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
GdkOffscreenWindow *offscreen;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
gdk_offscreen_window_set_embedder (window, NULL);
@ -111,11 +105,11 @@ get_surface (GdkOffscreenWindow *offscreen)
{
if (! offscreen->surface)
{
GdkWindowObject *private = (GdkWindowObject *) offscreen->wrapper;
GdkWindow *window = offscreen->wrapper;
g_signal_emit_by_name (private, "create-surface",
private->width,
private->height,
g_signal_emit_by_name (window, "create-surface",
window->width,
window->height,
&offscreen->surface);
}
@ -141,9 +135,9 @@ is_parent_of (GdkWindow *parent,
}
static cairo_surface_t *
gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable)
gdk_offscreen_window_ref_cairo_surface (GdkWindow *window)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
return cairo_surface_reference (get_surface (offscreen));
}
@ -153,14 +147,13 @@ _gdk_offscreen_window_create_surface (GdkWindow *offscreen,
gint width,
gint height)
{
GdkWindowObject *private = (GdkWindowObject *) offscreen;
cairo_surface_t *similar;
cairo_surface_t *surface;
cairo_content_t content = CAIRO_CONTENT_COLOR;
g_return_val_if_fail (GDK_IS_OFFSCREEN_WINDOW (private->impl), NULL);
g_return_val_if_fail (GDK_IS_OFFSCREEN_WINDOW (offscreen->impl), NULL);
similar = _gdk_drawable_ref_cairo_surface ((GdkWindow *)private->parent);
similar = _gdk_window_ref_cairo_surface (offscreen->parent);
if (gdk_window_get_visual (offscreen) ==
gdk_screen_get_rgba_visual (gdk_window_get_screen (offscreen)))
@ -180,7 +173,6 @@ _gdk_offscreen_window_new (GdkWindow *window,
GdkWindowAttr *attributes,
gint attributes_mask)
{
GdkWindowObject *private;
GdkOffscreenWindow *offscreen;
g_return_if_fail (attributes != NULL);
@ -188,13 +180,11 @@ _gdk_offscreen_window_new (GdkWindow *window,
if (attributes->wclass != GDK_INPUT_OUTPUT)
return; /* Can't support input only offscreens */
private = (GdkWindowObject *)window;
if (private->parent != NULL && GDK_WINDOW_DESTROYED (private->parent))
if (window->parent != NULL && GDK_WINDOW_DESTROYED (window->parent))
return;
private->impl = g_object_new (GDK_TYPE_OFFSCREEN_WINDOW, NULL);
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
window->impl = g_object_new (GDK_TYPE_OFFSCREEN_WINDOW, NULL);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
offscreen->wrapper = window;
}
@ -204,15 +194,13 @@ gdk_offscreen_window_reparent (GdkWindow *window,
gint x,
gint y)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowObject *new_parent_private = (GdkWindowObject *)new_parent;
GdkWindowObject *old_parent;
GdkWindow *old_parent;
gboolean was_mapped;
if (new_parent)
{
/* No input-output children of input-only windows */
if (new_parent_private->input_only && !private->input_only)
if (new_parent->input_only && !window->input_only)
return FALSE;
/* Don't create loops in hierarchy */
@ -224,20 +212,20 @@ gdk_offscreen_window_reparent (GdkWindow *window,
gdk_window_hide (window);
if (private->parent)
private->parent->children = g_list_remove (private->parent->children, window);
if (window->parent)
window->parent->children = g_list_remove (window->parent->children, window);
old_parent = private->parent;
private->parent = new_parent_private;
private->x = x;
private->y = y;
old_parent = window->parent;
window->parent = new_parent;
window->x = x;
window->y = y;
if (new_parent_private)
private->parent->children = g_list_prepend (private->parent->children, window);
if (new_parent)
window->parent->children = g_list_prepend (window->parent->children, window);
_gdk_synthesize_crossing_events_for_geometry_change (window);
if (old_parent)
_gdk_synthesize_crossing_events_for_geometry_change (GDK_WINDOW (old_parent));
_gdk_synthesize_crossing_events_for_geometry_change (old_parent);
return was_mapped;
}
@ -247,11 +235,7 @@ from_embedder (GdkWindow *window,
double embedder_x, double embedder_y,
double *offscreen_x, double *offscreen_y)
{
GdkWindowObject *private;
private = (GdkWindowObject *)window;
g_signal_emit_by_name (private->impl_window,
g_signal_emit_by_name (window->impl_window,
"from-embedder",
embedder_x, embedder_y,
offscreen_x, offscreen_y,
@ -263,11 +247,7 @@ to_embedder (GdkWindow *window,
double offscreen_x, double offscreen_y,
double *embedder_x, double *embedder_y)
{
GdkWindowObject *private;
private = (GdkWindowObject *)window;
g_signal_emit_by_name (private->impl_window,
g_signal_emit_by_name (window->impl_window,
"to-embedder",
offscreen_x, offscreen_y,
embedder_x, embedder_y,
@ -281,14 +261,13 @@ gdk_offscreen_window_get_root_coords (GdkWindow *window,
gint *root_x,
gint *root_y)
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
GdkOffscreenWindow *offscreen;
int tmpx, tmpy;
tmpx = x;
tmpy = y;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (offscreen->embedder)
{
double dx, dy;
@ -318,7 +297,6 @@ gdk_offscreen_window_get_device_state (GdkWindow *window,
gint *y,
GdkModifierType *mask)
{
GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
GdkOffscreenWindow *offscreen;
int tmpx, tmpy;
double dtmpx, dtmpy;
@ -328,7 +306,7 @@ gdk_offscreen_window_get_device_state (GdkWindow *window,
tmpy = 0;
tmpmask = 0;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (offscreen->embedder != NULL)
{
gdk_window_get_device_position (offscreen->embedder, device, &tmpx, &tmpy, &tmpmask);
@ -361,15 +339,14 @@ gdk_offscreen_window_get_device_state (GdkWindow *window,
cairo_surface_t *
gdk_offscreen_window_get_surface (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
if (!GDK_IS_OFFSCREEN_WINDOW (private->impl))
if (!GDK_IS_OFFSCREEN_WINDOW (window->impl))
return NULL;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
return get_surface (offscreen);
}
@ -396,33 +373,32 @@ gdk_offscreen_window_move_resize_internal (GdkWindow *window,
gint height,
gboolean send_expose_events)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
gint dx, dy, dw, dh;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (width < 1)
width = 1;
if (height < 1)
height = 1;
if (private->destroyed)
if (window->destroyed)
return;
dx = x - private->x;
dy = y - private->y;
dw = width - private->width;
dh = height - private->height;
dx = x - window->x;
dy = y - window->y;
dw = width - window->width;
dh = height - window->height;
private->x = x;
private->y = y;
window->x = x;
window->y = y;
if (private->width != width ||
private->height != height)
if (window->width != width ||
window->height != height)
{
private->width = width;
private->height = height;
window->width = width;
window->height = height;
if (offscreen->surface)
{
@ -443,7 +419,7 @@ gdk_offscreen_window_move_resize_internal (GdkWindow *window,
}
}
if (GDK_WINDOW_IS_MAPPED (private))
if (GDK_WINDOW_IS_MAPPED (window))
{
// TODO: Only invalidate new area, i.e. for larger windows
gdk_window_invalidate_rect (window, NULL, TRUE);
@ -459,22 +435,21 @@ gdk_offscreen_window_move_resize (GdkWindow *window,
gint width,
gint height)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (!with_move)
{
x = private->x;
y = private->y;
x = window->x;
y = window->y;
}
if (width < 0)
width = private->width;
width = window->width;
if (height < 0)
height = private->height;
height = window->height;
gdk_offscreen_window_move_resize_internal (window, x, y,
width, height,
@ -485,8 +460,7 @@ static void
gdk_offscreen_window_show (GdkWindow *window,
gboolean already_mapped)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkRectangle area = { 0, 0, private->width, private->height };
GdkRectangle area = { 0, 0, window->width, window->height };
gdk_window_invalidate_rect (window, &area, FALSE);
}
@ -495,14 +469,12 @@ gdk_offscreen_window_show (GdkWindow *window,
static void
gdk_offscreen_window_hide (GdkWindow *window)
{
GdkWindowObject *private;
GdkOffscreenWindow *offscreen;
GdkDisplay *display;
g_return_if_fail (window != NULL);
private = (GdkWindowObject*) window;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
/* May need to break grabs on children */
display = gdk_window_get_display (window);
@ -580,22 +552,18 @@ gdk_offscreen_window_get_geometry (GdkWindow *window,
gint *height,
gint *depth)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window == NULL || GDK_IS_WINDOW (window));
if (!GDK_WINDOW_DESTROYED (window))
{
if (x)
*x = private->x;
*x = window->x;
if (y)
*y = private->y;
*y = window->y;
if (width)
*width = private->width;
*width = window->width;
if (height)
*height = private->height;
*height = window->height;
if (depth)
*depth = private->depth;
*depth = window->depth;
}
}
@ -612,7 +580,7 @@ gdk_offscreen_window_translate (GdkWindow *window,
gint dx,
gint dy)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (((GdkWindowObject *) window)->impl);
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (offscreen->surface)
{
@ -672,26 +640,25 @@ void
gdk_offscreen_window_set_embedder (GdkWindow *window,
GdkWindow *embedder)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
g_return_if_fail (GDK_IS_WINDOW (window));
if (!GDK_IS_OFFSCREEN_WINDOW (private->impl))
if (!GDK_IS_OFFSCREEN_WINDOW (window->impl))
return;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (embedder)
{
g_object_ref (embedder);
GDK_WINDOW_OBJECT (embedder)->num_offscreen_children++;
embedder->num_offscreen_children++;
}
if (offscreen->embedder)
{
g_object_unref (offscreen->embedder);
GDK_WINDOW_OBJECT (offscreen->embedder)->num_offscreen_children--;
offscreen->embedder->num_offscreen_children--;
}
offscreen->embedder = embedder;
@ -711,15 +678,14 @@ gdk_offscreen_window_set_embedder (GdkWindow *window,
GdkWindow *
gdk_offscreen_window_get_embedder (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
if (!GDK_IS_OFFSCREEN_WINDOW (private->impl))
if (!GDK_IS_OFFSCREEN_WINDOW (window->impl))
return NULL;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
return offscreen->embedder;
}
@ -727,35 +693,30 @@ gdk_offscreen_window_get_embedder (GdkWindow *window)
static void
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
{
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_offscreen_window_finalize;
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
}
static void
gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface)
{
iface->show = gdk_offscreen_window_show;
iface->hide = gdk_offscreen_window_hide;
iface->withdraw = gdk_offscreen_window_withdraw;
iface->raise = gdk_offscreen_window_raise;
iface->lower = gdk_offscreen_window_lower;
iface->move_resize = gdk_offscreen_window_move_resize;
iface->set_background = gdk_offscreen_window_set_background;
iface->get_events = gdk_offscreen_window_get_events;
iface->set_events = gdk_offscreen_window_set_events;
iface->reparent = gdk_offscreen_window_reparent;
iface->get_geometry = gdk_offscreen_window_get_geometry;
iface->shape_combine_region = gdk_offscreen_window_shape_combine_region;
iface->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
iface->set_static_gravities = gdk_offscreen_window_set_static_gravities;
iface->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
iface->translate = gdk_offscreen_window_translate;
iface->get_root_coords = gdk_offscreen_window_get_root_coords;
iface->get_device_state = gdk_offscreen_window_get_device_state;
iface->destroy = gdk_offscreen_window_destroy;
iface->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
impl_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
impl_class->show = gdk_offscreen_window_show;
impl_class->hide = gdk_offscreen_window_hide;
impl_class->withdraw = gdk_offscreen_window_withdraw;
impl_class->raise = gdk_offscreen_window_raise;
impl_class->lower = gdk_offscreen_window_lower;
impl_class->move_resize = gdk_offscreen_window_move_resize;
impl_class->set_background = gdk_offscreen_window_set_background;
impl_class->get_events = gdk_offscreen_window_get_events;
impl_class->set_events = gdk_offscreen_window_set_events;
impl_class->reparent = gdk_offscreen_window_reparent;
impl_class->get_geometry = gdk_offscreen_window_get_geometry;
impl_class->shape_combine_region = gdk_offscreen_window_shape_combine_region;
impl_class->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
impl_class->set_static_gravities = gdk_offscreen_window_set_static_gravities;
impl_class->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
impl_class->translate = gdk_offscreen_window_translate;
impl_class->get_root_coords = gdk_offscreen_window_get_root_coords;
impl_class->get_device_state = gdk_offscreen_window_get_device_state;
impl_class->destroy = gdk_offscreen_window_destroy;
impl_class->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
}

View File

@ -91,7 +91,7 @@ gdk_pixbuf_get_from_window (GdkWindow *src,
g_return_val_if_fail (GDK_IS_WINDOW (src), NULL);
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
surface = _gdk_drawable_ref_cairo_surface (src);
surface = _gdk_window_ref_cairo_surface (src);
dest = gdk_pixbuf_get_from_surface (surface,
src_x, src_y,
width, height);

View File

@ -31,27 +31,12 @@
G_BEGIN_DECLS
#ifndef GDK_COMPILATION
#define GDK_WINDOW_TYPE(d) (gdk_window_get_window_type (GDK_WINDOW (d)))
#define GDK_WINDOW_DESTROYED(d) (gdk_window_is_destroyed (GDK_WINDOW (d)))
#endif
void gdk_window_destroy_notify (GdkWindow *window);
void gdk_synthesize_window_state (GdkWindow *window,
GdkWindowState unset_flags,
GdkWindowState set_flags);
/* Tests whether a pair of x,y may cause overflows when converted to Pango
* units (multiplied by PANGO_SCALE). We don't allow the entire range, leave
* some space for additions afterwards, to be safe...
*/
#define GDK_PANGO_UNITS_OVERFLOWS(x,y) (G_UNLIKELY ( \
(y) >= PANGO_PIXELS (G_MAXINT-PANGO_SCALE)/2 || \
(x) >= PANGO_PIXELS (G_MAXINT-PANGO_SCALE)/2 || \
(y) <=-PANGO_PIXELS (G_MAXINT-PANGO_SCALE)/2 || \
(x) <=-PANGO_PIXELS (G_MAXINT-PANGO_SCALE)/2))
G_END_DECLS
#endif /* __GDK_PRIVATE_H__ */

View File

@ -115,8 +115,8 @@ parse_rgb_value (const char *str,
/**
* gdk_rgba_parse:
* @spec: the string specifying the color
* @rgba: the #GdkRGBA struct to fill in
* @spec: the string specifying the color
*
* Parses a textual representation of a color, filling in
* the <structfield>red</structfield>, <structfield>green</structfield>,
@ -150,8 +150,8 @@ parse_rgb_value (const char *str,
* Since: 3.0
**/
gboolean
gdk_rgba_parse (const gchar *spec,
GdkRGBA *rgba)
gdk_rgba_parse (GdkRGBA *rgba,
const gchar *spec)
{
gboolean has_alpha;
gdouble r, g, b, a;

View File

@ -48,8 +48,8 @@ struct _GdkRGBA
GdkRGBA * gdk_rgba_copy (GdkRGBA *rgba);
void gdk_rgba_free (GdkRGBA *rgba);
gboolean gdk_rgba_parse (const gchar *spec,
GdkRGBA *rgba);
gboolean gdk_rgba_parse (GdkRGBA *rgba,
const gchar *spec);
guint gdk_rgba_hash (gconstpointer p);
gboolean gdk_rgba_equal (gconstpointer p1,

View File

@ -139,14 +139,12 @@ typedef struct _GdkRGBA GdkRGBA;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkVisual GdkVisual;
typedef struct _GdkDrawable GdkDrawable;
/**
* GdkWindow:
*
* An opaque structure representing an onscreen drawable.
*/
typedef struct _GdkDrawable GdkWindow;
typedef struct _GdkWindow GdkWindow;
typedef struct _GdkDisplay GdkDisplay;
typedef struct _GdkScreen GdkScreen;

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@
#ifndef __GDK_WINDOW_H__
#define __GDK_WINDOW_H__
#include <gdk/gdkdrawable.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
@ -43,7 +42,7 @@ typedef struct _GdkPointerHooks GdkPointerHooks;
typedef struct _GdkWindowRedirect GdkWindowRedirect;
/**
* GdkWindowClass:
* GdkWindowWindowClass:
* @GDK_INPUT_OUTPUT: window for graphics and events
* @GDK_INPUT_ONLY: window for events only
*
@ -57,7 +56,7 @@ typedef enum
{
GDK_INPUT_OUTPUT,
GDK_INPUT_ONLY
} GdkWindowClass;
} GdkWindowWindowClass;
/**
* GdkWindowType:
@ -346,7 +345,7 @@ struct _GdkWindowAttr
gint x, y;
gint width;
gint height;
GdkWindowClass wclass;
GdkWindowWindowClass wclass;
GdkVisual *visual;
GdkWindowType window_type;
GdkCursor *cursor;
@ -476,19 +475,19 @@ struct _GdkPointerHooks
};
typedef struct _GdkWindowObject GdkWindowObject;
typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
typedef struct _GdkWindowClass GdkWindowClass;
#define GDK_TYPE_WINDOW (gdk_window_object_get_type ())
#define GDK_TYPE_WINDOW (gdk_window_get_type ())
#define GDK_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
#define GDK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
#define GDK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowClass))
#define GDK_IS_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
#define GDK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
#define GDK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
#define GDK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowClass))
struct _GdkWindowObjectClass
struct _GdkWindowClass
{
GdkDrawableClass parent_class;
GObjectClass parent_class;
GdkWindow * (* pick_embedded_child) (GdkWindow *window,
gdouble x,
@ -522,7 +521,7 @@ struct _GdkWindowObjectClass
/* Windows
*/
GType gdk_window_object_get_type (void) G_GNUC_CONST;
GType gdk_window_get_type (void) G_GNUC_CONST;
GdkWindow* gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask);
@ -680,6 +679,10 @@ void gdk_window_set_geometry_hints (GdkWindow *window,
GdkWindowHints geom_mask);
void gdk_set_sm_client_id (const gchar *sm_client_id);
cairo_region_t *gdk_window_get_clip_region (GdkWindow *window);
cairo_region_t *gdk_window_get_visible_region(GdkWindow *window);
void gdk_window_begin_paint_rect (GdkWindow *window,
const GdkRectangle *rectangle);
void gdk_window_begin_paint_region (GdkWindow *window,

View File

@ -31,11 +31,23 @@
#include "gdkinternals.h"
typedef GdkWindowImplIface GdkWindowImplInterface;
G_DEFINE_INTERFACE (GdkWindowImpl, gdk_window_impl, G_TYPE_OBJECT);
G_DEFINE_TYPE (GdkWindowImpl, gdk_window_impl, G_TYPE_OBJECT);
static gboolean
gdk_window_impl_beep (GdkWindow *window)
{
/* FALSE means windows can't beep, so the display will be
* made to beep instead. */
return FALSE;
}
static void
gdk_window_impl_default_init (GdkWindowImplInterface *iface)
gdk_window_impl_class_init (GdkWindowImplClass *impl_class)
{
impl_class->beep = gdk_window_impl_beep;
}
static void
gdk_window_impl_init (GdkWindowImpl *impl)
{
}

View File

@ -32,16 +32,26 @@
G_BEGIN_DECLS
#define GDK_TYPE_WINDOW_IMPL (gdk_window_impl_get_type ())
#define GDK_WINDOW_IMPL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
#define GDK_IS_WINDOW_IMPL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WINDOW_IMPL))
#define GDK_WINDOW_IMPL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplIface))
#define GDK_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
#define GDK_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
#define GDK_IS_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL))
#define GDK_IS_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL))
#define GDK_WINDOW_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
typedef struct _GdkWindowImpl GdkWindowImpl; /* dummy */
typedef struct _GdkWindowImplIface GdkWindowImplIface;
typedef struct _GdkWindowImpl GdkWindowImpl;
typedef struct _GdkWindowImplClass GdkWindowImplClass;
struct _GdkWindowImplIface
struct _GdkWindowImpl
{
GTypeInterface g_iface;
GObject parent;
};
struct _GdkWindowImplClass
{
GObjectClass parent_class;
cairo_surface_t *
(* ref_cairo_surface) (GdkWindow *window);
void (* show) (GdkWindow *window,
gboolean already_mapped);
@ -94,6 +104,8 @@ struct _GdkWindowImplIface
gint *y,
GdkModifierType *mask);
cairo_region_t * (* get_shape) (GdkWindow *window);
cairo_region_t * (* get_input_shape) (GdkWindow *window);
void (* shape_combine_region) (GdkWindow *window,
const cairo_region_t *shape_region,
gint offset_x,
@ -146,6 +158,9 @@ struct _GdkWindowImplIface
cairo_surface_t *surface,
gint width,
gint height);
/* optional */
gboolean (* beep) (GdkWindow *window);
};
/* Interface Functions */

View File

@ -478,7 +478,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);
@ -508,7 +508,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);
@ -536,7 +536,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);
@ -563,7 +563,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_set_device (event, gdk_drag_context_get_device (current_context));
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);
@ -592,7 +592,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_set_device (event,
gdk_drag_context_get_device (_gdk_quartz_drag_source_context));
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);

View File

@ -670,8 +670,7 @@ gdk_event_dispatch (GSource *source,
if (event)
{
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);
}

View File

@ -473,12 +473,6 @@ _gdk_window_impl_quartz_get_type (void)
return object_type;
}
GType
_gdk_window_impl_get_type (void)
{
return _gdk_window_impl_quartz_get_type ();
}
static const gchar *
get_default_title (void)
{
@ -834,7 +828,7 @@ _gdk_window_impl_new (GdkWindow *window,
private = (GdkWindowObject *)window;
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_QUARTZ, NULL);
private->impl = (GdkDrawable *)impl;
draw_impl = GDK_DRAWABLE_IMPL_QUARTZ (impl);
draw_impl->wrapper = GDK_DRAWABLE (window);
@ -2925,14 +2919,6 @@ gdk_window_destroy_notify (GdkWindow *window)
check_grab_destroy (window);
}
void
_gdk_windowing_window_beep (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
gdk_display_beep (_gdk_display);
}
void
gdk_window_set_opacity (GdkWindow *window,
gdouble opacity)
@ -2960,15 +2946,15 @@ _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
{
}
cairo_region_t *
_gdk_windowing_window_get_shape (GdkWindow *window)
static cairo_region_t *
gdk_quartz_window_get_shape (GdkWindow *window)
{
/* FIXME: implement */
return NULL;
}
cairo_region_t *
_gdk_windowing_window_get_input_shape (GdkWindow *window)
static cairo_region_t *
gdk_quartz_window_get_input_shape (GdkWindow *window)
{
/* FIXME: implement */
return NULL;
@ -2999,6 +2985,8 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->translate = _gdk_quartz_window_translate;
iface->destroy = _gdk_quartz_window_destroy;
iface->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
iface->get_shape = gdk_quartz_window_get_shape;
iface->get_input_shape = gdk_quartz_window_get_input_shape;
}

View File

@ -8,17 +8,17 @@ test_color_parse (void)
GdkRGBA expected;
gboolean res;
res = gdk_rgba_parse ("foo", &color);
res = gdk_rgba_parse (&color, "foo");
g_assert (!res);
res = gdk_rgba_parse ("", &color);
res = gdk_rgba_parse (&color, "");
g_assert (!res);
expected.red = 100/255.;
expected.green = 90/255.;
expected.blue = 80/255.;
expected.alpha = 0.1;
res = gdk_rgba_parse ("rgba(100,90,80,0.1)", &color);
res = gdk_rgba_parse (&color, "rgba(100,90,80,0.1)");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
@ -26,11 +26,11 @@ test_color_parse (void)
expected.green = 0.3;
expected.blue = 0.2;
expected.alpha = 0.1;
res = gdk_rgba_parse ("rgba(40%,30%,20%,0.1)", &color);
res = gdk_rgba_parse (&color, "rgba(40%,30%,20%,0.1)");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
res = gdk_rgba_parse ("rgba( 40 % , 30 % , 20 % , 0.1 )", &color);
res = gdk_rgba_parse (&color, "rgba( 40 % , 30 % , 20 % , 0.1 )");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
@ -38,7 +38,7 @@ test_color_parse (void)
expected.green = 0.0;
expected.blue = 0.0;
expected.alpha = 1.0;
res = gdk_rgba_parse ("red", &color);
res = gdk_rgba_parse (&color, "red");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
@ -46,7 +46,7 @@ test_color_parse (void)
expected.green = 0x8080 / 65535.;
expected.blue = 1.0;
expected.alpha = 1.0;
res = gdk_rgba_parse ("#0080ff", &color);
res = gdk_rgba_parse (&color, "#0080ff");
g_assert (res);
g_assert (gdk_rgba_equal (&color, &expected));
}
@ -71,7 +71,7 @@ test_color_to_string (void)
orig = g_strdup (setlocale (LC_ALL, NULL));
res = gdk_rgba_to_string (&rgba);
gdk_rgba_parse (res, &out);
gdk_rgba_parse (&out, res);
g_assert (gdk_rgba_equal (&rgba, &out));
setlocale (LC_ALL, "de_DE.utf-8");
@ -94,7 +94,6 @@ int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
gdk_init (&argc, &argv);
g_test_add_func ("/color/parse", test_color_parse);
g_test_add_func ("/color/to-string", test_color_to_string);

View File

@ -34,20 +34,8 @@
#include <pango/pangowin32.h>
#include <cairo-win32.h>
#include "gdkscreen.h" /* gdk_screen_get_default() */
#include "gdkprivate-win32.h"
#define ROP3_D 0x00AA0029
#define ROP3_DSna 0x00220326
#define ROP3_DSPDxax 0x00E20746
#define LINE_ATTRIBUTES (GDK_GC_LINE_WIDTH|GDK_GC_LINE_STYLE| \
GDK_GC_CAP_STYLE|GDK_GC_JOIN_STYLE)
#define MUST_RENDER_DASHES_MANUALLY(gcwin32) \
(gcwin32->line_style == GDK_LINE_DOUBLE_DASH || \
(gcwin32->line_style == GDK_LINE_ON_OFF_DASH && gcwin32->pen_dash_offset))
static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
static cairo_surface_t *gdk_win32_create_cairo_surface (GdkDrawable *drawable,
int width,

View File

@ -756,7 +756,6 @@ _gdk_win32_print_event (const GdkEvent *event)
CASE (GDK_DROP_FINISHED);
CASE (GDK_CLIENT_EVENT);
CASE (GDK_VISIBILITY_NOTIFY);
CASE (GDK_NO_EXPOSE);
CASE (GDK_SCROLL);
CASE (GDK_WINDOW_STATE);
CASE (GDK_SETTING);
@ -3019,54 +3018,51 @@ gdk_event_translate (MSG *msg,
/* We need to render to clipboard immediately, don't call
* append_event()
*/
if (_gdk_event_func)
{
event = gdk_event_new (GDK_SELECTION_REQUEST);
event->selection.window = window;
event->selection.send_event = FALSE;
event->selection.selection = GDK_SELECTION_CLIPBOARD;
event->selection.target = target;
event->selection.property = _gdk_selection;
event->selection.requestor = msg->hwnd;
event->selection.time = msg->time;
event = gdk_event_new (GDK_SELECTION_REQUEST);
event->selection.window = window;
event->selection.send_event = FALSE;
event->selection.selection = GDK_SELECTION_CLIPBOARD;
event->selection.target = target;
event->selection.property = _gdk_selection;
event->selection.requestor = msg->hwnd;
event->selection.time = msg->time;
fixup_event (event);
GDK_NOTE (EVENTS, g_print (" (calling gdk_event_func)"));
GDK_NOTE (EVENTS, _gdk_win32_print_event (event));
(*_gdk_event_func) (event, _gdk_event_data);
gdk_event_free (event);
fixup_event (event);
GDK_NOTE (EVENTS, g_print (" (calling _gdk_event_emit)"));
GDK_NOTE (EVENTS, _gdk_win32_print_event (event));
_gdk_event_emit (event);
gdk_event_free (event);
/* Now the clipboard owner should have rendered */
if (!_delayed_rendering_data)
{
GDK_NOTE (EVENTS, g_print (" (no _delayed_rendering_data?)"));
}
else
{
if (msg->wParam == CF_DIB)
{
_delayed_rendering_data =
_gdk_win32_selection_convert_to_dib (_delayed_rendering_data,
target);
if (!_delayed_rendering_data)
{
g_warning ("Cannot convert to DIB from delayed rendered image");
break;
}
}
/* Now the clipboard owner should have rendered */
if (!_delayed_rendering_data)
{
GDK_NOTE (EVENTS, g_print (" (no _delayed_rendering_data?)"));
}
else
{
if (msg->wParam == CF_DIB)
{
_delayed_rendering_data =
_gdk_win32_selection_convert_to_dib (_delayed_rendering_data,
target);
if (!_delayed_rendering_data)
{
g_warning ("Cannot convert to DIB from delayed rendered image");
break;
}
}
/* The requestor is holding the clipboard, no
* OpenClipboard() is required/possible
*/
GDK_NOTE (DND,
g_print (" SetClipboardData(%s,%p)",
_gdk_win32_cf_to_string (msg->wParam),
_delayed_rendering_data));
/* The requestor is holding the clipboard, no
* OpenClipboard() is required/possible
*/
GDK_NOTE (DND,
g_print (" SetClipboardData(%s,%p)",
_gdk_win32_cf_to_string (msg->wParam),
_delayed_rendering_data));
API_CALL (SetClipboardData, (msg->wParam, _delayed_rendering_data));
_delayed_rendering_data = NULL;
}
}
API_CALL (SetClipboardData, (msg->wParam, _delayed_rendering_data));
_delayed_rendering_data = NULL;
}
break;
case WM_ACTIVATE:
@ -3223,8 +3219,7 @@ gdk_event_dispatch (GSource *source,
if (event)
{
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);

View File

@ -99,12 +99,6 @@ _gdk_window_impl_win32_get_type (void)
return object_type;
}
GType
_gdk_window_impl_get_type (void)
{
return _gdk_window_impl_win32_get_type ();
}
static void
gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
{
@ -211,7 +205,7 @@ _gdk_windowing_window_init (GdkScreen *screen)
_gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *)_gdk_root;
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
private->impl_window = private;
private->visual = gdk_screen_get_system_visual (screen);
@ -435,7 +429,7 @@ _gdk_window_impl_new (GdkWindow *window,
hparent = GDK_WINDOW_HWND (real_parent);
impl = g_object_new (_gdk_window_impl_get_type (), NULL);
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
private->impl = (GdkDrawable *)impl;
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (impl);
draw_impl->wrapper = GDK_DRAWABLE (window);
@ -641,7 +635,7 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
window = g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *)window;
private->visual = gdk_screen_get_system_visual (_gdk_screen);
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
private->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
draw_impl->wrapper = GDK_DRAWABLE (window);
@ -3127,12 +3121,6 @@ gdk_window_configure_finished (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
}
void
_gdk_windowing_window_beep (GdkWindow *window)
{
gdk_display_beep (_gdk_display);
}
void
gdk_window_set_opacity (GdkWindow *window,
gdouble opacity)
@ -3176,8 +3164,8 @@ _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
{
}
cairo_region_t *
_gdk_windowing_window_get_shape (GdkWindow *window)
static cairo_region_t *
gdk_win32_window_get_shape (GdkWindow *window)
{
HRGN hrgn = CreateRectRgn (0, 0, 0, 0);
int type = GetWindowRgn (GDK_WINDOW_HWND (window), hrgn);
@ -3193,8 +3181,8 @@ _gdk_windowing_window_get_shape (GdkWindow *window)
return NULL;
}
cairo_region_t *
_gdk_windowing_window_get_input_shape (GdkWindow *window)
static cairo_region_t *
_gdk_win32_window_get_input_shape (GdkWindow *window)
{
/* CHECK: are these really supposed to be the same? */
return _gdk_windowing_window_get_shape (window);
@ -3312,6 +3300,8 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->translate = _gdk_win32_window_translate;
iface->destroy = _gdk_win32_window_destroy;
iface->resize_cairo_surface = gdk_win32_window_resize_cairo_surface;
iface->get_shape = gdk_win32_window_get_shape;
iface->get_input_shape = gdk_win32_window_get_input_shape;
}
gboolean

View File

@ -30,8 +30,6 @@ libgdk_x11_la_SOURCES = \
gdkdisplay-x11.c \
gdkdisplay-x11.h \
gdkdnd-x11.c \
gdkdrawable-x11.c \
gdkdrawable-x11.h \
gdkeventsource.c \
gdkeventsource.h \
gdkeventtranslator.c \

View File

@ -36,54 +36,43 @@
#include <unistd.h>
static char *
get_display_name (GFile *file)
get_display_name (GFile *file,
GFileInfo *info)
{
GFileInfo *info;
char *name, *tmp;
/* This does sync I/O, which isn't ideal.
* It should probably use the NautilusFile machinery
*/
name = NULL;
info = g_file_query_info (file,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, 0, NULL, NULL);
if (info)
{
name = g_strdup (g_file_info_get_display_name (info));
g_object_unref (info);
}
name = g_strdup (g_file_info_get_display_name (info));
if (name == NULL)
{
name = g_file_get_basename (file);
if (!g_utf8_validate (name, -1, NULL))
{
tmp = name;
name =
g_uri_escape_string (name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH,
TRUE);
g_free (tmp);
}
{
tmp = name;
name =
g_uri_escape_string (name, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
g_free (tmp);
}
}
return name;
}
static GIcon *
get_icon (GFile *file)
get_icon (GFile *file,
GFileInfo *info)
{
GFileInfo *info;
GIcon *icon;
icon = NULL;
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_ICON, 0, NULL, NULL);
if (info)
{
icon = g_file_info_get_icon (info);
if (icon)
g_object_ref (icon);
g_object_unref (info);
g_object_ref (icon);
}
return icon;
@ -99,13 +88,13 @@ gicon_to_string (GIcon *icon)
{
file = g_file_icon_get_file (G_FILE_ICON (icon));
if (file)
return g_file_get_path (file);
return g_file_get_path (file);
}
else if (G_IS_THEMED_ICON (icon))
{
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
if (names)
return g_strdup (names[0]);
return g_strdup (names[0]);
}
else if (G_IS_EMBLEMED_ICON (icon))
{
@ -121,11 +110,11 @@ gicon_to_string (GIcon *icon)
static void
end_startup_notification (GdkDisplay *display,
const char *startup_id)
const char *startup_id)
{
gdk_x11_display_broadcast_startup_message (display, "remove",
"ID", startup_id,
NULL);
"ID", startup_id,
NULL);
}
@ -210,19 +199,19 @@ startup_timeout (void *data)
next = tmp->next;
elapsed =
((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - sn_data->time.tv_usec))) / 1000.0;
((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - sn_data->time.tv_usec))) / 1000.0;
if (elapsed >= STARTUP_TIMEOUT_LENGTH)
{
std->contexts = g_slist_remove (std->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
}
{
std->contexts = g_slist_remove (std->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
}
else
{
min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
}
{
min_timeout = MIN (min_timeout, (STARTUP_TIMEOUT_LENGTH - elapsed));
}
tmp = next;
}
@ -239,7 +228,7 @@ startup_timeout (void *data)
static void
add_startup_timeout (GdkScreen *screen,
const char *startup_id)
const char *startup_id)
{
StartupTimeoutData *data;
StartupNotificationData *sn_data;
@ -253,7 +242,7 @@ add_startup_timeout (GdkScreen *screen,
data->timeout_id = 0;
g_object_set_data_full (G_OBJECT (screen), "appinfo-startup-data",
data, free_startup_timeout);
data, free_startup_timeout);
}
sn_data = g_new (StartupNotificationData, 1);
@ -265,14 +254,14 @@ add_startup_timeout (GdkScreen *screen,
if (data->timeout_id == 0)
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
startup_timeout, data);
startup_timeout, data);
}
char *
_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
GAppInfo *info,
GList *files)
{
static int sequence = 0;
GdkAppLaunchContextPrivate *priv;
@ -288,6 +277,7 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
GIcon *icon;
guint32 timestamp;
char *startup_id;
GFileInfo *fileinfo;
priv = GDK_APP_LAUNCH_CONTEXT (context)->priv;
@ -307,20 +297,32 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
screen = gdk_display_get_default_screen (display);
}
fileinfo = NULL;
files_count = g_list_length (files);
if (files_count == 0)
description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info));
{
description = g_strdup_printf (_("Starting %s"), g_app_info_get_name (info));
}
else if (files_count == 1)
{
gchar *display_name = get_display_name (files->data);
gchar *display_name;
if (g_file_is_native (files->data))
fileinfo = g_file_query_info (files->data,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
G_FILE_ATTRIBUTE_STANDARD_ICON,
0, NULL, NULL);
display_name = get_display_name (files->data, fileinfo);
description = g_strdup_printf (_("Opening %s"), display_name);
g_free (display_name);
}
else
description = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
"Opening %d Item",
"Opening %d Items",
files_count), files_count);
"Opening %d Item",
"Opening %d Items",
files_count), files_count);
icon_name = NULL;
if (priv->icon_name)
@ -330,18 +332,18 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
icon = NULL;
if (priv->icon != NULL)
icon = g_object_ref (priv->icon);
icon = g_object_ref (priv->icon);
else if (files_count == 1)
icon = get_icon (files->data);
icon = get_icon (files->data, fileinfo);
if (icon == NULL)
{
icon = g_app_info_get_icon (info);
g_object_ref (icon);
}
{
icon = g_app_info_get_icon (info);
g_object_ref (icon);
}
if (icon)
icon_name = gicon_to_string (icon);
icon_name = gicon_to_string (icon);
g_object_unref (icon);
}
@ -353,7 +355,7 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
timestamp = gdk_x11_display_get_user_time (display);
screen_str = g_strdup_printf ("%d", gdk_screen_get_number (screen));
if (priv->workspace > -1)
if (priv->workspace > -1)
workspace_str = g_strdup_printf ("%d", priv->workspace);
else
workspace_str = NULL;
@ -364,30 +366,31 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
application_id = NULL;
startup_id = g_strdup_printf ("%s-%lu-%s-%s-%d_TIME%lu",
g_get_prgname (),
(unsigned long)getpid (),
g_get_host_name (),
binary_name,
sequence++,
(unsigned long)timestamp);
g_get_prgname (),
(unsigned long)getpid (),
g_get_host_name (),
binary_name,
sequence++,
(unsigned long)timestamp);
gdk_x11_display_broadcast_startup_message (display, "new",
"ID", startup_id,
"NAME", g_app_info_get_name (info),
"SCREEN", screen_str,
"BIN", binary_name,
"ICON", icon_name,
"DESKTOP", workspace_str,
"DESCRIPTION", description,
"WMCLASS", NULL, /* FIXME */
"APPLICATION_ID", application_id,
NULL);
"ID", startup_id,
"NAME", g_app_info_get_name (info),
"SCREEN", screen_str,
"BIN", binary_name,
"ICON", icon_name,
"DESKTOP", workspace_str,
"DESCRIPTION", description,
"WMCLASS", NULL, /* FIXME */
"APPLICATION_ID", application_id,
NULL);
g_free (description);
g_free (screen_str);
g_free (workspace_str);
g_free (icon_name);
if (fileinfo)
g_object_unref (fileinfo);
add_startup_timeout (screen, startup_id);
@ -396,8 +399,8 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
void
_gdk_windowing_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
_gdk_windowing_launch_failed (GAppLaunchContext *context,
const char *startup_notify_id)
{
GdkAppLaunchContextPrivate *priv;
GdkScreen *screen;
@ -419,22 +422,22 @@ _gdk_windowing_launch_failed (GAppLaunchContext *context,
if (data)
{
for (l = data->contexts; l != NULL; l = l->next)
{
sn_data = l->data;
if (strcmp (startup_notify_id, sn_data->startup_id) == 0)
{
data->contexts = g_slist_remove (data->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
break;
}
}
{
sn_data = l->data;
if (strcmp (startup_notify_id, sn_data->startup_id) == 0)
{
data->contexts = g_slist_remove (data->contexts, sn_data);
end_startup_notification (sn_data->display, sn_data->startup_id);
free_startup_notification_data (sn_data);
break;
}
}
if (data->contexts == NULL)
{
g_source_remove (data->timeout_id);
data->timeout_id = 0;
}
{
g_source_remove (data->timeout_id);
data->timeout_id = 0;
}
}
}

View File

@ -1035,6 +1035,6 @@ gdk_display_get_maximal_cursor_size (GdkDisplay *display,
screen = gdk_display_get_default_screen (display);
window = gdk_screen_get_root_window (screen);
XQueryBestCursor (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XWINDOW (window),
GDK_WINDOW_XID (window),
128, 128, width, height);
}

View File

@ -21,6 +21,7 @@
#include "gdkdevice-core.h"
#include "gdkinternals.h"
#include "gdkwindow.h"
#include "gdkprivate-x11.h"
#include "gdkx.h"
@ -104,14 +105,12 @@ impl_coord_in_window (GdkWindow *window,
int impl_x,
int impl_y)
{
GdkWindowObject *priv = (GdkWindowObject *) window;
if (impl_x < priv->abs_x ||
impl_x > priv->abs_x + priv->width)
if (impl_x < window->abs_x ||
impl_x >= window->abs_x + window->width)
return FALSE;
if (impl_y < priv->abs_y ||
impl_y > priv->abs_y + priv->height)
if (impl_y < window->abs_y ||
impl_y >= window->abs_y + window->height)
return FALSE;
return TRUE;
@ -125,7 +124,6 @@ gdk_device_core_get_history (GdkDevice *device,
GdkTimeCoord ***events,
gint *n_events)
{
GdkWindowObject *priv;
XTimeCoord *xcoords;
GdkTimeCoord **coords;
GdkWindow *impl_window;
@ -133,13 +131,12 @@ gdk_device_core_get_history (GdkDevice *device,
int i, j;
impl_window = _gdk_window_get_impl_window (window);
xcoords = XGetMotionEvents (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (impl_window),
xcoords = XGetMotionEvents (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (impl_window),
start, stop, &tmp_n_events);
if (!xcoords)
return FALSE;
priv = (GdkWindowObject *) window;
coords = _gdk_device_allocate_history (device, tmp_n_events);
for (i = 0, j = 0; i < tmp_n_events; i++)
@ -147,8 +144,8 @@ gdk_device_core_get_history (GdkDevice *device,
if (impl_coord_in_window (window, xcoords[i].x, xcoords[i].y))
{
coords[j]->time = xcoords[i].time;
coords[j]->axes[0] = xcoords[i].x - priv->abs_x;
coords[j]->axes[1] = xcoords[i].y - priv->abs_y;
coords[j]->axes[0] = xcoords[i].x - window->abs_x;
coords[j]->axes[1] = xcoords[i].y - window->abs_y;
j++;
}
}
@ -228,7 +225,7 @@ gdk_device_core_warp (GdkDevice *device,
Window dest;
xdisplay = GDK_DISPLAY_XDISPLAY (gdk_device_get_display (device));
dest = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
XWarpPointer (xdisplay, None, dest, 0, 0, 0, 0, x, y);
}
@ -428,7 +425,7 @@ gdk_device_core_window_at_position (GdkDevice *device,
if (get_toplevel && last != root &&
(window = gdk_window_lookup_for_display (display, last)) != NULL &&
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
window->window_type != GDK_WINDOW_FOREIGN)
{
xwindow = last;
break;
@ -497,6 +494,6 @@ gdk_device_core_select_window_events (GdkDevice *device,
xmask |= StructureNotifyMask | PropertyChangeMask;
XSelectInput (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XWINDOW (window),
GDK_WINDOW_XID (window),
xmask);
}

View File

@ -443,7 +443,7 @@ gdk_device_xi_grab (GdkDevice *device,
status = XGrabDevice (GDK_WINDOW_XDISPLAY (window),
device_xi->xdevice,
GDK_WINDOW_XWINDOW (window),
GDK_WINDOW_XID (window),
owner_events,
num_classes, event_classes,
GrabModeAsync, GrabModeAsync,
@ -492,7 +492,7 @@ gdk_device_xi_select_window_events (GdkDevice *device,
find_events (device, event_mask, event_classes, &num_classes);
XSelectExtensionEvent (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XWINDOW (window),
GDK_WINDOW_XID (window),
event_classes, num_classes);
if (event_mask)

View File

@ -258,13 +258,13 @@ gdk_device_xi2_set_window_cursor (GdkDevice *device,
XIDefineCursor (GDK_WINDOW_XDISPLAY (window),
priv->device_id,
GDK_WINDOW_XWINDOW (window),
GDK_WINDOW_XID (window),
cursor_private->xcursor);
}
else
XIUndefineCursor (GDK_WINDOW_XDISPLAY (window),
priv->device_id,
GDK_WINDOW_XWINDOW (window));
GDK_WINDOW_XID (window));
}
static void
@ -277,7 +277,7 @@ gdk_device_xi2_warp (GdkDevice *device,
Window dest;
priv = GDK_DEVICE_XI2 (device)->priv;
dest = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen));
dest = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
XIWarpPointer (GDK_SCREEN_XDISPLAY (screen),
priv->device_id,
@ -512,7 +512,7 @@ gdk_device_xi2_select_window_events (GdkDevice *device,
evmask.mask = gdk_device_xi2_translate_event_mask (event_mask, &evmask.mask_len);
XISelectEvents (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XWINDOW (window),
GDK_WINDOW_XID (window),
&evmask, 1);
g_free (evmask.mask);

View File

@ -415,7 +415,6 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
{
GdkDeviceManagerCore *device_manager;
GdkWindow *window;
GdkWindowObject *window_private;
GdkWindowImplX11 *window_impl = NULL;
gboolean return_val;
GdkToplevelX11 *toplevel = NULL;
@ -425,7 +424,6 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
return_val = FALSE;
window = get_event_window (translator, xevent);
window_private = (GdkWindowObject *) window;
if (window)
{
@ -433,14 +431,14 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
return FALSE;
toplevel = _gdk_x11_window_get_toplevel (window);
window_impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
window_impl = GDK_WINDOW_IMPL_X11 (window->impl);
g_object_ref (window);
}
event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
if (window_private && GDK_WINDOW_DESTROYED (window))
if (window && GDK_WINDOW_DESTROYED (window))
{
if (xevent->type != DestroyNotify)
{
@ -472,7 +470,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
switch (xevent->type)
{
case KeyPress:
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -482,7 +480,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
break;
case KeyRelease:
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -518,7 +516,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.button));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -590,7 +588,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.button));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -628,7 +626,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
xevent->xmotion.x, xevent->xmotion.y,
(xevent->xmotion.is_hint) ? "true" : "false"));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -661,7 +659,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
xevent->xcrossing.detail,
xevent->xcrossing.subwindow));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -705,7 +703,7 @@ gdk_device_manager_core_translate_event (GdkEventTranslator *translator,
xevent->xcrossing.window,
xevent->xcrossing.detail, xevent->xcrossing.subwindow));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;

View File

@ -369,7 +369,7 @@ gdk_device_manager_xi2_constructed (GObject *object)
event_mask.mask = mask;
_gdk_device_manager_xi2_select_events (GDK_DEVICE_MANAGER (object),
GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen)),
GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
&event_mask);
}

View File

@ -31,6 +31,7 @@
#include "gdkdisplay.h"
#include "gdkeventsource.h"
#include "gdkeventtranslator.h"
#include "gdkinternals.h"
#include "gdkscreen.h"
#include "gdkscreen-x11.h"
#include "gdkinternals.h"
@ -382,7 +383,6 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
XEvent *xevent)
{
GdkWindow *window;
GdkWindowObject *window_private;
GdkWindowImplX11 *window_impl = NULL;
GdkScreen *screen = NULL;
GdkScreenX11 *screen_x11 = NULL;
@ -396,7 +396,6 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
* are reported same as structure events
*/
window = get_event_window (translator, xevent);
window_private = (GdkWindowObject *) window;
if (window)
{
@ -409,7 +408,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
screen = GDK_WINDOW_SCREEN (window);
screen_x11 = GDK_SCREEN_X11 (screen);
toplevel = _gdk_x11_window_get_toplevel (window);
window_impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
window_impl = GDK_WINDOW_IMPL_X11 (window->impl);
xwindow = GDK_WINDOW_XID (window);
g_object_ref (window);
@ -418,7 +417,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event->any.window = window;
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
if (window_private && GDK_WINDOW_DESTROYED (window))
if (window && GDK_WINDOW_DESTROYED (window))
{
if (xevent->type != DestroyNotify)
{
@ -480,7 +479,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
xevent->xexpose.width, xevent->xexpose.height,
event->any.send_event ? " (send)" : ""));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -508,7 +507,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
g_message ("graphics expose:\tdrawable: %ld",
xevent->xgraphicsexpose.drawable));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -524,16 +523,6 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
}
break;
case NoExpose:
GDK_NOTE (EVENTS,
g_message ("no expose:\t\tdrawable: %ld",
xevent->xnoexpose.drawable));
event->no_expose.type = GDK_NO_EXPOSE;
event->no_expose.window = window;
break;
case VisibilityNotify:
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_EVENTS)
@ -554,7 +543,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
}
#endif /* G_ENABLE_DEBUG */
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -605,7 +594,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event->any.type = GDK_DESTROY;
event->any.window = window;
return_val = window_private && !GDK_WINDOW_DESTROYED (window);
return_val = window && !GDK_WINDOW_DESTROYED (window);
if (window && GDK_WINDOW_XID (window) != screen_x11->xroot_window)
gdk_window_destroy_notify (window);
@ -649,7 +638,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event->any.window = window;
/* Unset iconified if it was set */
if (window && (((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_ICONIFIED))
if (window && (window->state & GDK_WINDOW_STATE_ICONIFIED))
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED,
0);
@ -682,18 +671,18 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
xevent->xconfigure.override_redirect,
!window
? " (discarding)"
: GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD
: window->window_type == GDK_WINDOW_CHILD
? " (discarding child)"
: xevent->xconfigure.event != xevent->xconfigure.window
? " (discarding substructure)"
: ""));
if (window && GDK_WINDOW_TYPE (window) == GDK_WINDOW_ROOT)
{
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
window->width = xevent->xconfigure.width;
window->height = xevent->xconfigure.height;
_gdk_window_update_size (window);
_gdk_x11_drawable_update_size (window_private->impl);
_gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
_gdk_x11_screen_size_changed (screen, xevent);
}
@ -726,8 +715,8 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
Window child_window = 0;
gdk_error_trap_push ();
if (XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
GDK_DRAWABLE_XID (window),
if (XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
screen_x11->xroot_window,
0, 0,
&tx, &ty,
@ -743,19 +732,19 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
event->configure.x = xevent->xconfigure.x;
event->configure.y = xevent->xconfigure.y;
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
window->x = event->configure.x;
window->y = event->configure.y;
window->width = xevent->xconfigure.width;
window->height = xevent->xconfigure.height;
_gdk_window_update_size (window);
_gdk_x11_drawable_update_size (window_private->impl);
_gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
if (window_private->resize_count >= 1)
if (window->resize_count >= 1)
{
window_private->resize_count -= 1;
window->resize_count -= 1;
if (window_private->resize_count == 0)
if (window->resize_count == 0)
_gdk_moveresize_configure_done (display, window);
}
}
@ -770,7 +759,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
gdk_x11_get_xatom_name_for_display (display, xevent->xproperty.atom),
"\""));
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
break;
@ -789,7 +778,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
gdk_check_wm_desktop_changed (window);
}
if (window_private->event_mask & GDK_PROPERTY_CHANGE_MASK)
if (window->event_mask & GDK_PROPERTY_CHANGE_MASK)
{
event->property.type = GDK_PROPERTY_NOTIFY;
event->property.window = window;
@ -894,7 +883,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
break;
case GDK_FILTER_CONTINUE:
/* Send unknown ClientMessage's on to Gtk for it to use */
if (window_private == NULL)
if (window == NULL)
{
return_val = FALSE;
}
@ -956,7 +945,7 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
else
#endif
#if defined(HAVE_XCOMPOSITE) && defined (HAVE_XDAMAGE) && defined (HAVE_XFIXES)
if (display_x11->have_xdamage && window_private && window_private->composited &&
if (display_x11->have_xdamage && window && window->composited &&
xevent->type == display_x11->xdamage_event_base + XDamageNotify &&
((XDamageNotifyEvent *) xevent)->damage == window_impl->damage)
{
@ -964,8 +953,8 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
XserverRegion repair;
GdkRectangle rect;
rect.x = window_private->x + damage_event->area.x;
rect.y = window_private->y + damage_event->area.y;
rect.x = window->x + damage_event->area.x;
rect.y = window->y + damage_event->area.y;
rect.width = damage_event->area.width;
rect.height = damage_event->area.height;
@ -976,8 +965,8 @@ gdk_display_x11_translate_event (GdkEventTranslator *translator,
repair, None);
XFixesDestroyRegion (display_x11->xdisplay, repair);
if (window_private->parent != NULL)
_gdk_window_process_expose (GDK_WINDOW (window_private->parent),
if (window->parent != NULL)
_gdk_window_process_expose (window->parent,
damage_event->serial, &rect);
return_val = TRUE;
@ -1066,12 +1055,11 @@ gdk_wm_protocols_filter (GdkXEvent *xev,
else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_TAKE_FOCUS"))
{
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (event->any.window);
GdkWindowObject *private = (GdkWindowObject *)win;
/* There is no way of knowing reliably whether we are viewable;
* _gdk_x11_set_input_focus_safe() traps errors asynchronously.
*/
if (toplevel && private->accept_focus)
if (toplevel && win->accept_focus)
_gdk_x11_set_input_focus_safe (display, toplevel->focus_window,
RevertToParent,
xevent->xclient.data.l[1]);

View File

@ -294,12 +294,12 @@ gdk_drag_context_find (GdkDisplay *display,
context_dest_xid = context->dest_window ?
(private->drop_xid ?
private->drop_xid :
GDK_DRAWABLE_XID (context->dest_window)) :
GDK_WINDOW_XID (context->dest_window)) :
None;
if ((!context->is_source == !is_source) &&
((source_xid == None) || (context->source_window &&
(GDK_DRAWABLE_XID (context->source_window) == source_xid))) &&
(GDK_WINDOW_XID (context->source_window) == source_xid))) &&
((dest_xid == None) || (context_dest_xid == dest_xid)))
return context;
@ -547,7 +547,7 @@ gdk_window_cache_new (GdkScreen *screen)
result->child_hash = g_hash_table_new (g_direct_hash, NULL);
result->screen = screen;
XGetWindowAttributes (xdisplay, GDK_WINDOW_XWINDOW (root_window), &xwa);
XGetWindowAttributes (xdisplay, GDK_WINDOW_XID (root_window), &xwa);
result->old_event_mask = xwa.your_event_mask;
if (G_UNLIKELY (!GDK_DISPLAY_X11 (GDK_SCREEN_X11 (screen)->display)->trusted_client))
@ -568,13 +568,13 @@ gdk_window_cache_new (GdkScreen *screen)
return result;
}
XSelectInput (xdisplay, GDK_WINDOW_XWINDOW (root_window),
XSelectInput (xdisplay, GDK_WINDOW_XID (root_window),
result->old_event_mask | SubstructureNotifyMask);
gdk_window_add_filter (root_window, gdk_window_cache_filter, result);
gdk_window_add_filter (NULL, gdk_window_cache_shape_filter, result);
if (!_gdk_x11_get_window_child_info (gdk_screen_get_display (screen),
GDK_WINDOW_XWINDOW (root_window),
GDK_WINDOW_XID (root_window),
FALSE, NULL,
&children, &nchildren))
return result;
@ -598,9 +598,9 @@ gdk_window_cache_new (GdkScreen *screen)
*/
if (gdk_screen_is_composited (screen))
{
cow = XCompositeGetOverlayWindow (xdisplay, GDK_WINDOW_XWINDOW (root_window));
cow = XCompositeGetOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
gdk_window_cache_add (result, cow, 0, 0, gdk_screen_get_width (screen), gdk_screen_get_height (screen), TRUE);
XCompositeReleaseOverlayWindow (xdisplay, GDK_WINDOW_XWINDOW (root_window));
XCompositeReleaseOverlayWindow (xdisplay, GDK_WINDOW_XID (root_window));
}
#endif
@ -613,7 +613,7 @@ gdk_window_cache_destroy (GdkWindowCache *cache)
GdkWindow *root_window = gdk_screen_get_root_window (cache->screen);
XSelectInput (GDK_WINDOW_XDISPLAY (root_window),
GDK_WINDOW_XWINDOW (root_window),
GDK_WINDOW_XID (root_window),
cache->old_event_mask);
gdk_window_remove_filter (root_window, gdk_window_cache_filter, cache);
gdk_window_remove_filter (NULL, gdk_window_cache_shape_filter, cache);
@ -774,7 +774,7 @@ get_client_window_at_coords (GdkWindowCache *cache,
if (retval)
return retval;
else
return GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (cache->screen));
return GDK_WINDOW_XID (gdk_screen_get_root_window (cache->screen));
}
/*************************************************************
@ -1405,8 +1405,8 @@ motif_set_targets (GdkDragContext *context)
info.selection_atom = private->motif_selection;
XChangeProperty (GDK_DRAWABLE_XDISPLAY (context->source_window),
GDK_DRAWABLE_XID (context->source_window),
XChangeProperty (GDK_WINDOW_XDISPLAY (context->source_window),
GDK_WINDOW_XID (context->source_window),
private->motif_selection,
gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_INITIATOR_INFO"),
8, PropModeReplace,
@ -1475,13 +1475,13 @@ motif_send_enter (GdkDragContext *context,
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_AND_DROP_MESSAGE");
xev.xclient.format = 8;
xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.window = GDK_WINDOW_XID (context->dest_window);
MOTIF_XCLIENT_BYTE (&xev, 0) = XmTOP_LEVEL_ENTER;
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
MOTIF_XCLIENT_SHORT (&xev, 1) = 0;
MOTIF_XCLIENT_LONG (&xev, 1) = time;
MOTIF_XCLIENT_LONG (&xev, 2) = GDK_DRAWABLE_XID (context->source_window);
MOTIF_XCLIENT_LONG (&xev, 2) = GDK_WINDOW_XID (context->source_window);
if (!private->motif_targets_set)
motif_set_targets (context);
@ -1490,11 +1490,11 @@ motif_send_enter (GdkDragContext *context,
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->dest_window),
GDK_WINDOW_XID (context->dest_window),
FALSE, 0, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
}
static void
@ -1507,7 +1507,7 @@ motif_send_leave (GdkDragContext *context,
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_AND_DROP_MESSAGE");
xev.xclient.format = 8;
xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.window = GDK_WINDOW_XID (context->dest_window);
MOTIF_XCLIENT_BYTE (&xev, 0) = XmTOP_LEVEL_LEAVE;
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
@ -1518,11 +1518,11 @@ motif_send_leave (GdkDragContext *context,
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->dest_window),
GDK_WINDOW_XID (context->dest_window),
FALSE, 0, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
}
static gboolean
@ -1540,7 +1540,7 @@ motif_send_motion (GdkDragContext *context,
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_AND_DROP_MESSAGE");
xev.xclient.format = 8;
xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.window = GDK_WINDOW_XID (context->dest_window);
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
MOTIF_XCLIENT_SHORT (&xev, 1) = motif_dnd_get_flags (context);
@ -1568,11 +1568,11 @@ motif_send_motion (GdkDragContext *context,
}
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->dest_window),
GDK_WINDOW_XID (context->dest_window),
FALSE, 0, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
return retval;
}
@ -1587,7 +1587,7 @@ motif_send_drop (GdkDragContext *context, guint32 time)
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_AND_DROP_MESSAGE");
xev.xclient.format = 8;
xev.xclient.window = GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.window = GDK_WINDOW_XID (context->dest_window);
MOTIF_XCLIENT_BYTE (&xev, 0) = XmDROP_START;
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
@ -1598,14 +1598,14 @@ motif_send_drop (GdkDragContext *context, guint32 time)
MOTIF_XCLIENT_SHORT (&xev, 5) = private->last_y;
MOTIF_XCLIENT_LONG (&xev, 3) = private->motif_selection;
MOTIF_XCLIENT_LONG (&xev, 4) = GDK_DRAWABLE_XID (context->source_window);
MOTIF_XCLIENT_LONG (&xev, 4) = GDK_WINDOW_XID (context->source_window);
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->dest_window),
GDK_WINDOW_XID (context->dest_window),
FALSE, 0, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
}
/* Target Side */
@ -1924,7 +1924,7 @@ motif_drag_status (GdkEvent *event,
if (!display)
return GDK_FILTER_REMOVE;
context = gdk_drag_context_find (display, TRUE, GDK_DRAWABLE_XID (event->any.window), None);
context = gdk_drag_context_find (display, TRUE, GDK_WINDOW_XID (event->any.window), None);
if (context)
{
@ -2228,8 +2228,8 @@ xdnd_set_targets (GdkDragContext *context)
i++;
}
XChangeProperty (GDK_DRAWABLE_XDISPLAY (context->source_window),
GDK_DRAWABLE_XID (context->source_window),
XChangeProperty (GDK_WINDOW_XDISPLAY (context->source_window),
GDK_WINDOW_XID (context->source_window),
gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"),
XA_ATOM, 32, PropModeReplace,
(guchar *)atomlist, n_atoms);
@ -2277,8 +2277,8 @@ xdnd_set_actions (GdkDragContext *context)
}
}
XChangeProperty (GDK_DRAWABLE_XDISPLAY (context->source_window),
GDK_DRAWABLE_XID (context->source_window),
XChangeProperty (GDK_WINDOW_XDISPLAY (context->source_window),
GDK_WINDOW_XID (context->source_window),
gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"),
XA_ATOM, 32, PropModeReplace,
(guchar *)atomlist, n_atoms);
@ -2397,7 +2397,7 @@ xdnd_send_xevent (GdkDragContext *context,
}
}
xwindow = GDK_WINDOW_XWINDOW (window);
xwindow = GDK_WINDOW_XID (window);
if (_gdk_x11_display_is_root_window (display, xwindow))
event_mask = ButtonPressMask;
@ -2422,8 +2422,8 @@ xdnd_send_enter (GdkDragContext *context)
xev.xclient.format = 32;
xev.xclient.window = private->drop_xid ?
private->drop_xid :
GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_DRAWABLE_XID (context->source_window);
GDK_WINDOW_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_WINDOW_XID (context->source_window);
xev.xclient.data.l[1] = (private->version << 24); /* version */
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
@ -2431,7 +2431,7 @@ xdnd_send_enter (GdkDragContext *context)
GDK_NOTE(DND,
g_message ("Sending enter source window %#lx XDND protocol version %d\n",
GDK_DRAWABLE_XID (context->source_window), private->version));
GDK_WINDOW_XID (context->source_window), private->version));
if (g_list_length (context->targets) > 3)
{
if (!private->xdnd_targets_set)
@ -2457,7 +2457,7 @@ xdnd_send_enter (GdkDragContext *context)
{
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
g_object_unref (context->dest_window);
context->dest_window = NULL;
}
@ -2476,8 +2476,8 @@ xdnd_send_leave (GdkDragContext *context)
xev.xclient.format = 32;
xev.xclient.window = private->drop_xid ?
private->drop_xid :
GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_DRAWABLE_XID (context->source_window);
GDK_WINDOW_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_WINDOW_XID (context->source_window);
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
@ -2488,7 +2488,7 @@ xdnd_send_leave (GdkDragContext *context)
{
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
g_object_unref (context->dest_window);
context->dest_window = NULL;
}
@ -2506,8 +2506,8 @@ xdnd_send_drop (GdkDragContext *context, guint32 time)
xev.xclient.format = 32;
xev.xclient.window = private->drop_xid ?
private->drop_xid :
GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_DRAWABLE_XID (context->source_window);
GDK_WINDOW_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_WINDOW_XID (context->source_window);
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = time;
xev.xclient.data.l[3] = 0;
@ -2518,7 +2518,7 @@ xdnd_send_drop (GdkDragContext *context, guint32 time)
{
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
g_object_unref (context->dest_window);
context->dest_window = NULL;
}
@ -2540,8 +2540,8 @@ xdnd_send_motion (GdkDragContext *context,
xev.xclient.format = 32;
xev.xclient.window = private->drop_xid ?
private->drop_xid :
GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_DRAWABLE_XID (context->source_window);
GDK_WINDOW_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_WINDOW_XID (context->source_window);
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = (x_root << 16) | y_root;
xev.xclient.data.l[3] = time;
@ -2552,7 +2552,7 @@ xdnd_send_motion (GdkDragContext *context,
{
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->dest_window)));
GDK_WINDOW_XID (context->dest_window)));
g_object_unref (context->dest_window);
context->dest_window = NULL;
}
@ -2654,7 +2654,7 @@ xdnd_read_actions (GdkDragContext *context)
gdk_error_trap_push ();
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_DRAWABLE_XID (context->source_window),
GDK_WINDOW_XID (context->source_window),
gdk_x11_get_xatom_by_name_for_display (display, "XdndActionList"),
0, 65536,
False, XA_ATOM, &type, &format, &nitems,
@ -2702,8 +2702,8 @@ xdnd_read_actions (GdkDragContext *context)
GdkDragContext *source_context;
source_context = gdk_drag_context_find (display, TRUE,
GDK_DRAWABLE_XID (context->source_window),
GDK_DRAWABLE_XID (context->dest_window));
GDK_WINDOW_XID (context->source_window),
GDK_WINDOW_XID (context->dest_window));
if (source_context)
{
@ -2903,7 +2903,7 @@ xdnd_enter_filter (GdkXEvent *xev,
if (get_types)
{
gdk_error_trap_push ();
XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (event->any.window),
XGetWindowProperty (GDK_WINDOW_XDISPLAY (event->any.window),
source_window,
gdk_x11_get_xatom_by_name_for_display (display, "XdndTypeList"),
0, 65536,
@ -2983,7 +2983,7 @@ xdnd_leave_filter (GdkXEvent *xev,
if ((display_x11->current_dest_drag != NULL) &&
(display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window))
(GDK_WINDOW_XID (display_x11->current_dest_drag->source_window) == source_window))
{
event->dnd.type = GDK_DRAG_LEAVE;
/* Pass ownership of context to the event */
@ -3028,7 +3028,7 @@ xdnd_position_filter (GdkXEvent *xev,
if ((display_x11->current_dest_drag != NULL) &&
(display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window))
(GDK_WINDOW_XID (display_x11->current_dest_drag->source_window) == source_window))
{
event->dnd.type = GDK_DRAG_MOTION;
event->dnd.context = display_x11->current_dest_drag;
@ -3080,7 +3080,7 @@ xdnd_drop_filter (GdkXEvent *xev,
if ((display_x11->current_dest_drag != NULL) &&
(display_x11->current_dest_drag->protocol == GDK_DRAG_PROTO_XDND) &&
(GDK_DRAWABLE_XID (display_x11->current_dest_drag->source_window) == source_window))
(GDK_WINDOW_XID (display_x11->current_dest_drag->source_window) == source_window))
{
GdkDragContextPrivateX11 *private;
private = PRIVATE_DATA (display_x11->current_dest_drag);
@ -3386,7 +3386,7 @@ gdk_drag_find_window_for_screen (GdkDragContext *context,
dest = get_client_window_at_coords (window_cache,
drag_window && GDK_WINDOW_IS_X11 (drag_window) ?
GDK_DRAWABLE_XID (drag_window) : None,
GDK_WINDOW_XID (drag_window) : None,
x_root, y_root);
if (private->dest_xid != dest)
@ -3478,7 +3478,7 @@ gdk_drag_motion (GdkDragContext *context,
GdkDisplay *display = GDK_WINDOW_DISPLAY (dest_window);
xdnd_check_dest (display,
GDK_DRAWABLE_XID (dest_window),
GDK_WINDOW_XID (dest_window),
&private->version);
}
}
@ -3498,8 +3498,8 @@ gdk_drag_motion (GdkDragContext *context,
GdkDragContext *dest_context;
dest_context = gdk_drag_context_find (display, FALSE,
GDK_DRAWABLE_XID (context->source_window),
GDK_DRAWABLE_XID (dest_window));
GDK_WINDOW_XID (context->source_window),
GDK_WINDOW_XID (dest_window));
if (dest_context)
{
@ -3733,7 +3733,7 @@ gdk_drag_status (GdkDragContext *context,
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display,
"_MOTIF_DRAG_AND_DROP_MESSAGE");
xev.xclient.format = 8;
xev.xclient.window = GDK_DRAWABLE_XID (context->source_window);
xev.xclient.window = GDK_WINDOW_XID (context->source_window);
if (private->drag_status == GDK_DRAG_STATUS_ACTION_WAIT)
{
@ -3795,20 +3795,20 @@ gdk_drag_status (GdkDragContext *context,
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->source_window),
GDK_WINDOW_XID (context->source_window),
FALSE, 0, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->source_window)));
GDK_WINDOW_XID (context->source_window)));
}
else if (context->protocol == GDK_DRAG_PROTO_XDND)
{
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndStatus");
xev.xclient.format = 32;
xev.xclient.window = GDK_DRAWABLE_XID (context->source_window);
xev.xclient.window = GDK_WINDOW_XID (context->source_window);
xev.xclient.data.l[0] = GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_WINDOW_XID (context->dest_window);
xev.xclient.data.l[1] = (action != 0) ? (2 | 1) : 0;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
@ -3818,7 +3818,7 @@ gdk_drag_status (GdkDragContext *context,
FALSE, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->source_window)));
GDK_WINDOW_XID (context->source_window)));
}
private->old_action = action;
@ -3875,7 +3875,7 @@ gdk_drop_reply (GdkDragContext *context,
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->source_window),
GDK_WINDOW_XID (context->source_window),
FALSE, 0, &xev);
}
}
@ -3905,9 +3905,9 @@ gdk_drop_finish (GdkDragContext *context,
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished");
xev.xclient.format = 32;
xev.xclient.window = GDK_DRAWABLE_XID (context->source_window);
xev.xclient.window = GDK_WINDOW_XID (context->source_window);
xev.xclient.data.l[0] = GDK_DRAWABLE_XID (context->dest_window);
xev.xclient.data.l[0] = GDK_WINDOW_XID (context->dest_window);
if (success)
{
xev.xclient.data.l[1] = 1;
@ -3926,7 +3926,7 @@ gdk_drop_finish (GdkDragContext *context,
FALSE, &xev))
GDK_NOTE (DND,
g_message ("Send event to %lx failed",
GDK_DRAWABLE_XID (context->source_window)));
GDK_WINDOW_XID (context->source_window)));
}
}
@ -3970,7 +3970,7 @@ gdk_window_register_dnd (GdkWindow *window)
info.num_drop_sites = 0;
info.total_size = sizeof(info);
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_DRAWABLE_XID (window),
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
motif_drag_receiver_info_atom,
motif_drag_receiver_info_atom,
8, PropModeReplace,
@ -3981,7 +3981,7 @@ gdk_window_register_dnd (GdkWindow *window)
/* The property needs to be of type XA_ATOM, not XA_INTEGER. Blech */
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_DRAWABLE_XID (window),
GDK_WINDOW_XID (window),
gdk_x11_get_xatom_by_name_for_display (display, "XdndAware"),
XA_ATOM, 32, PropModeReplace,
(guchar *)&xdnd_version, 1);

View File

@ -1,235 +0,0 @@
/* GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkdrawable-x11.h"
#include "gdkx.h"
#include "gdkprivate-x11.h"
#include "gdkscreen-x11.h"
#include "gdkdisplay-x11.h"
#include <cairo-xlib.h>
#include <stdlib.h>
#include <string.h>
static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable);
static cairo_surface_t *gdk_x11_create_cairo_surface (GdkDrawable *drawable,
int width,
int height);
static const cairo_user_data_key_t gdk_x11_cairo_key;
G_DEFINE_TYPE (GdkDrawableImplX11, _gdk_drawable_impl_x11, GDK_TYPE_DRAWABLE)
static void
_gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
{
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
drawable_class->create_cairo_surface = gdk_x11_create_cairo_surface;
}
static void
_gdk_drawable_impl_x11_init (GdkDrawableImplX11 *impl)
{
}
/**
* _gdk_x11_drawable_finish:
* @drawable: a #GdkDrawableImplX11.
*
* Performs necessary cleanup prior to destroying a window.
**/
void
_gdk_x11_drawable_finish (GdkDrawable *drawable)
{
GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
if (impl->cairo_surface)
{
cairo_surface_finish (impl->cairo_surface);
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
NULL, NULL);
}
}
/**
* _gdk_x11_drawable_update_size:
* @drawable: a #GdkDrawableImplX11.
*
* Updates the state of the drawable (in particular the drawable's
* cairo surface) when its size has changed.
**/
void
_gdk_x11_drawable_update_size (GdkDrawable *drawable)
{
GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
if (impl->cairo_surface)
{
cairo_xlib_surface_set_size (impl->cairo_surface,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
}
}
/*****************************************************
* X11 specific implementations of generic functions *
*****************************************************/
static GdkDrawable *
get_impl_drawable (GdkDrawable *drawable)
{
if (GDK_IS_WINDOW (drawable))
return ((GdkWindowObject *)drawable)->impl;
else
{
g_warning (G_STRLOC " drawable is not a window");
return NULL;
}
}
/**
* gdk_x11_drawable_get_xdisplay:
* @drawable: a #GdkDrawable.
*
* Returns the display of a #GdkDrawable.
*
* Return value: an Xlib <type>Display*</type>.
**/
Display *
gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable)
{
if (GDK_IS_DRAWABLE_IMPL_X11 (drawable))
return GDK_SCREEN_XDISPLAY (GDK_DRAWABLE_IMPL_X11 (drawable)->screen);
else
return GDK_SCREEN_XDISPLAY (GDK_DRAWABLE_IMPL_X11 (get_impl_drawable (drawable))->screen);
}
/**
* gdk_x11_drawable_get_xid:
* @drawable: a #GdkDrawable.
*
* Returns the X resource (window) belonging to a #GdkDrawable.
*
* Return value: the ID of @drawable's X resource.
**/
XID
gdk_x11_drawable_get_xid (GdkDrawable *drawable)
{
GdkDrawable *impl;
if (GDK_IS_WINDOW (drawable))
{
GdkWindow *window = (GdkWindow *)drawable;
/* Try to ensure the window has a native window */
if (!_gdk_window_has_impl (window))
{
gdk_window_ensure_native (window);
/* We sync here to ensure the window is created in the Xserver when
* this function returns. This is required because the returned XID
* for this window must be valid immediately, even with another
* connection to the Xserver */
gdk_display_sync (gdk_window_get_display (window));
}
if (!GDK_WINDOW_IS_X11 (window))
{
g_warning (G_STRLOC " drawable is not a native X11 window");
return None;
}
impl = ((GdkWindowObject *)drawable)->impl;
}
else
{
g_warning (G_STRLOC " drawable is not a window");
return None;
}
return ((GdkDrawableImplX11 *)impl)->xid;
}
GdkDrawable *
gdk_x11_window_get_drawable_impl (GdkWindow *window)
{
return ((GdkWindowObject *)window)->impl;
}
static void
gdk_x11_cairo_surface_destroy (void *data)
{
GdkDrawableImplX11 *impl = data;
impl->cairo_surface = NULL;
}
static cairo_surface_t *
gdk_x11_create_cairo_surface (GdkDrawable *drawable,
int width,
int height)
{
GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
GdkVisual *visual;
visual = gdk_window_get_visual (impl->wrapper);
return cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
impl->xid,
GDK_VISUAL_XVISUAL (visual),
width, height);
}
static cairo_surface_t *
gdk_x11_ref_cairo_surface (GdkDrawable *drawable)
{
GdkDrawableImplX11 *impl = GDK_DRAWABLE_IMPL_X11 (drawable);
if (GDK_IS_WINDOW_IMPL_X11 (drawable) &&
GDK_WINDOW_DESTROYED (impl->wrapper))
return NULL;
if (!impl->cairo_surface)
{
impl->cairo_surface = gdk_x11_create_cairo_surface (drawable,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
if (impl->cairo_surface)
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
drawable, gdk_x11_cairo_surface_destroy);
}
else
cairo_surface_reference (impl->cairo_surface);
return impl->cairo_surface;
}

View File

@ -1,75 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_DRAWABLE_X11_H__
#define __GDK_DRAWABLE_X11_H__
#include <gdk/gdkdrawable.h>
#include <X11/Xlib.h>
G_BEGIN_DECLS
/* Drawable implementation for X11
*/
typedef struct _GdkDrawableImplX11 GdkDrawableImplX11;
typedef struct _GdkDrawableImplX11Class GdkDrawableImplX11Class;
#define GDK_TYPE_DRAWABLE_IMPL_X11 (_gdk_drawable_impl_x11_get_type ())
#define GDK_DRAWABLE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL_X11, GdkDrawableImplX11))
#define GDK_DRAWABLE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE_IMPL_X11, GdkDrawableImplX11Class))
#define GDK_IS_DRAWABLE_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_X11))
#define GDK_IS_DRAWABLE_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE_IMPL_X11))
#define GDK_DRAWABLE_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE_IMPL_X11, GdkDrawableImplX11Class))
struct _GdkDrawableImplX11
{
GdkDrawable parent_instance;
GdkDrawable *wrapper;
Window xid;
GdkScreen *screen;
cairo_surface_t *cairo_surface;
};
struct _GdkDrawableImplX11Class
{
GdkDrawableClass parent_class;
};
GType _gdk_drawable_impl_x11_get_type (void);
/* Note that the following take GdkDrawableImplX11, not the wrapper drawable */
void _gdk_x11_drawable_finish (GdkDrawable *drawable);
void _gdk_x11_drawable_update_size (GdkDrawable *drawable);
GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_DRAWABLE_X11_H__ */

View File

@ -179,15 +179,14 @@ gdk_event_source_translate_event (GdkEventSource *event_source,
if (filter_window)
{
/* Apply per-window filters */
GdkWindowObject *filter_private = (GdkWindowObject *) filter_window;
GdkFilterReturn result;
event->any.window = g_object_ref (filter_window);
if (filter_private->filters)
if (filter_window->filters)
{
result = gdk_event_apply_filters (xevent, event,
&filter_private->filters);
&filter_window->filters);
if (result == GDK_FILTER_REMOVE)
{
@ -319,8 +318,7 @@ gdk_event_source_dispatch (GSource *source,
if (event)
{
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
_gdk_event_emit (event);
gdk_event_free (event);
}

View File

@ -60,13 +60,9 @@ _gdk_window_move_resize_child (GdkWindow *window,
gint width,
gint height)
{
GdkWindowObject *obj;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
obj = GDK_WINDOW_OBJECT (window);
if (width > 65535 ||
height > 65535)
{
@ -78,10 +74,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
height = 65535;
}
obj->x = x;
obj->y = y;
obj->width = width;
obj->height = height;
window->x = x;
window->y = y;
window->width = width;
window->height = height;
/* We don't really care about origin overflow, because on overflow
the window won't be visible anyway and thus it will be shaped
@ -91,8 +87,8 @@ _gdk_window_move_resize_child (GdkWindow *window,
_gdk_x11_window_tmp_unset_bg (window, TRUE);
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
obj->x + obj->parent->abs_x,
obj->y + obj->parent->abs_y,
window->x + window->parent->abs_x,
window->y + window->parent->abs_y,
width, height);
_gdk_x11_window_tmp_reset_parent_bg (window);
_gdk_x11_window_tmp_reset_bg (window, TRUE);
@ -227,15 +223,15 @@ gdk_window_queue (GdkWindow *window,
}
static GC
_get_scratch_gc (GdkWindowObject *window, cairo_region_t *clip_region)
_get_scratch_gc (GdkWindow *window, cairo_region_t *clip_region)
{
GdkScreenX11 *screen;
XRectangle *rectangles;
gint n_rects;
gint depth;
screen = GDK_SCREEN_X11 (gdk_window_get_screen (GDK_WINDOW (window)));
depth = gdk_visual_get_depth (gdk_window_get_visual (GDK_WINDOW (window))) - 1;
screen = GDK_SCREEN_X11 (gdk_window_get_screen (window));
depth = gdk_visual_get_depth (gdk_window_get_visual (window)) - 1;
if (!screen->subwindow_gcs[depth])
{
@ -276,7 +272,7 @@ _gdk_x11_window_translate (GdkWindow *window,
GdkWindowQueueItem *item;
GC xgc;
GdkRectangle extents;
GdkWindowObject *private, *impl;
GdkWindow *parent;
int px, py;
/* We need to get data from subwindows here, because we might have
@ -285,19 +281,19 @@ _gdk_x11_window_translate (GdkWindow *window,
* from overlapping native window that are not children of this window,
* so we copy from the toplevel with INCLUDE_INFERIORS.
*/
private = impl = (GdkWindowObject *) window;
parent = window;
px = py = 0;
while (private->parent != NULL &&
private->parent->window_type != GDK_WINDOW_ROOT)
while (parent->parent != NULL &&
parent->parent->window_type != GDK_WINDOW_ROOT)
{
dx -= private->parent->abs_x + private->x;
dy -= private->parent->abs_y + private->y;
private = (GdkWindowObject *) _gdk_window_get_impl_window ((GdkWindow *) private->parent);
dx -= parent->parent->abs_x + parent->x;
dy -= parent->parent->abs_y + parent->y;
parent = _gdk_window_get_impl_window (parent->parent);
}
cairo_region_get_extents (area, &extents);
xgc = _get_scratch_gc (impl, area);
xgc = _get_scratch_gc (window, area);
cairo_region_translate (area, -dx, -dy); /* Move to source region */
@ -308,9 +304,9 @@ _gdk_x11_window_translate (GdkWindow *window,
item->u.translate.dy = dy;
gdk_window_queue (window, item);
XCopyArea (GDK_WINDOW_XDISPLAY (impl),
GDK_DRAWABLE_IMPL_X11 (private->impl)->xid,
GDK_DRAWABLE_IMPL_X11 (impl->impl)->xid,
XCopyArea (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (parent),
GDK_WINDOW_XID (window),
xgc,
extents.x - dx, extents.y - dy,
extents.width, extents.height,

View File

@ -66,7 +66,7 @@ _gdk_input_select_device_events (GdkWindow *impl_window,
GdkDevice *device)
{
guint event_mask;
GdkWindowObject *w;
GdkWindow *w;
GdkInputWindow *iw;
GdkInputMode mode;
gboolean has_cursor;
@ -74,7 +74,7 @@ _gdk_input_select_device_events (GdkWindow *impl_window,
GList *l;
event_mask = 0;
iw = ((GdkWindowObject *)impl_window)->input_window;
iw = impl_window->input_window;
g_object_get (device,
"type", &type,
@ -98,7 +98,7 @@ _gdk_input_select_device_events (GdkWindow *impl_window,
if (event_mask)
event_mask |= GDK_PROXIMITY_OUT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK;
gdk_window_set_device_events ((GdkWindow *) w, device, event_mask);
gdk_window_set_device_events (w, device, event_mask);
}
}
}
@ -106,18 +106,16 @@ _gdk_input_select_device_events (GdkWindow *impl_window,
static void
unset_extension_events (GdkWindow *window)
{
GdkWindowObject *window_private;
GdkWindowObject *impl_window;
GdkWindow *impl_window;
GdkDisplayX11 *display_x11;
GdkInputWindow *iw;
window_private = (GdkWindowObject*) window;
impl_window = (GdkWindowObject *)_gdk_window_get_impl_window (window);
impl_window = _gdk_window_get_impl_window (window);
iw = impl_window->input_window;
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
if (window_private->extension_events != 0)
if (window->extension_events != 0)
{
g_assert (iw != NULL);
g_assert (g_list_find (iw->windows, window) != NULL);
@ -131,7 +129,7 @@ unset_extension_events (GdkWindow *window)
}
}
window_private->extension_events = 0;
window->extension_events = 0;
}
/**
@ -150,8 +148,7 @@ gdk_input_set_extension_events (GdkWindow *window,
gint mask,
GdkExtensionMode mode)
{
GdkWindowObject *window_private;
GdkWindowObject *impl_window;
GdkWindow *impl_window;
GdkInputWindow *iw;
GdkDisplayX11 *display_x11;
#ifndef XINPUT_NONE
@ -161,12 +158,11 @@ gdk_input_set_extension_events (GdkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_WINDOW_IS_X11 (window));
window_private = (GdkWindowObject*) window;
display_x11 = GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (window));
if (GDK_WINDOW_DESTROYED (window))
return;
impl_window = (GdkWindowObject *)_gdk_window_get_impl_window (window);
impl_window = _gdk_window_get_impl_window (window);
if (mode == GDK_EXTENSION_EVENTS_ALL && mask != 0)
mask |= GDK_ALL_DEVICES_MASK;
@ -190,9 +186,9 @@ gdk_input_set_extension_events (GdkWindow *window,
impl_window->input_window = iw;
}
if (window_private->extension_events == 0)
if (window->extension_events == 0)
iw->windows = g_list_append (iw->windows, window);
window_private->extension_events = mask;
window->extension_events = mask;
}
else
{

Some files were not shown because too many files have changed in this diff Show More