Compare commits
224 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a3f1acb3f | |||
| 73b45ec77e | |||
| 8f95a5980e | |||
| 87d33470ed | |||
| 002e48c469 | |||
| f33549da91 | |||
| f3f32b47cc | |||
| 2c5f2a2bcb | |||
| b6d990af25 | |||
| 16171a232a | |||
| 031b5cad46 | |||
| 984274497d | |||
| 0cc0714312 | |||
| 766e2b1e63 | |||
| c8be597b7f | |||
| 4497ac7d75 | |||
| af21583d4d | |||
| d398c00d20 | |||
| cb247276f5 | |||
| c6141dffd2 | |||
| 755d8f8332 | |||
| 32de29bb68 | |||
| 540cb58169 | |||
| a1a6e6a36a | |||
| 798ad9f62a | |||
| ad6255a841 | |||
| 6adaf7c33d | |||
| 95a4eff6ba | |||
| 9675c99043 | |||
| 76d0e1e398 | |||
| 14408b7485 | |||
| 2a11baf6ea | |||
| 51d40ca023 | |||
| 5d9d73b090 | |||
| 5f7e093168 | |||
| 0f70e6d70a | |||
| 259be23ff2 | |||
| 337eedb513 | |||
| 185354555c | |||
| 29905d1ce6 | |||
| 73dd73c859 | |||
| cfb0df14cc | |||
| b343abfa51 | |||
| 5df4d27752 | |||
| bbf5d142b3 | |||
| 1fbbaef49e | |||
| d88268c142 | |||
| 49ae68c2c7 | |||
| 1d72e3e193 | |||
| 77c3ef48cf | |||
| 20deda2bd6 | |||
| 447b166ed3 | |||
| 1b230324ba | |||
| 806c659efe | |||
| 51873ebe37 | |||
| 827219e214 | |||
| 5c9b25c66e | |||
| 37e4ae2fbd | |||
| 14f86ae24d | |||
| 849ffebc21 | |||
| 7dabc2a42c | |||
| bef8a3a0e9 | |||
| 31d2638088 | |||
| 40019517cf | |||
| 7a8f5ca970 | |||
| 4063c3dc31 | |||
| 96d0368290 | |||
| 9a0ec5b1e0 | |||
| 7b5a0a829a | |||
| 1030d9e5b1 | |||
| 0750b4fd28 | |||
| 1d4ce5a544 | |||
| 4b2d63167e | |||
| 6fe0a8c6b3 | |||
| 04eb7eef29 | |||
| 480a2c2770 | |||
| f699fff6e0 | |||
| 4bc145549d | |||
| cf7fa931d3 | |||
| 392b4d9ac5 | |||
| 3f126c7fc8 | |||
| 960717b273 | |||
| 5386cf89f2 | |||
| b7d948af69 | |||
| 446b2e25d3 | |||
| 17b1e7bae9 | |||
| 9dc679370c | |||
| 033cf4bfb7 | |||
| bf5f27c6d5 | |||
| 7a1073c3ae | |||
| e2fd33f78a | |||
| 89f25d1484 | |||
| 3c8b3cbf41 | |||
| 410d4bca83 | |||
| 168523264c | |||
| 435f143e2e | |||
| 98ccb67277 | |||
| 2d83bb1b91 | |||
| 298b6ee81a | |||
| 5ce3520a2a | |||
| 9cc3e2c8ef | |||
| 034f89b17f | |||
| 1ea09a327a | |||
| bc2f484ae9 | |||
| 228f813c43 | |||
| 17386b5cf7 | |||
| 288086b899 | |||
| d148f26658 | |||
| 7ca6440f4d | |||
| 1172810768 | |||
| 9c827cbff4 | |||
| da3aaf39b9 | |||
| a8926c9d87 | |||
| 443f8ddf6b | |||
| 6a7de806dd | |||
| 19873e549a | |||
| 05ca6bc189 | |||
| cbb1e74bb5 | |||
| 6afb6bb9d2 | |||
| 60afd056e0 | |||
| 4456b06853 | |||
| 2f72353e0e | |||
| 88af7b44aa | |||
| a7cd1918a8 | |||
| bcfd1bbd24 | |||
| 1a5e60be7c | |||
| 3ce3867403 | |||
| 00a61f92b6 | |||
| 986daa8225 | |||
| e72ca43a32 | |||
| f432c937cc | |||
| 1dd15b5237 | |||
| 5cdbbc6e61 | |||
| 0e2ac0ebf2 | |||
| c73cb2c154 | |||
| a756caa106 | |||
| da22ba3b86 | |||
| 7a0a92f2b6 | |||
| d927c3bee0 | |||
| 59c2efbcd6 | |||
| 94af080fb6 | |||
| 40841ec3be | |||
| f69bb2fb2b | |||
| db0b9f61ae | |||
| 63ab523146 | |||
| b94c3166bf | |||
| 7030e08f9c | |||
| 2cc6a3ee5c | |||
| 3dd188fe7e | |||
| d41603d82a | |||
| f7aff03c72 | |||
| a0b8e32462 | |||
| 50f76eb8cc | |||
| 9959ea98cd | |||
| 8ca3ac1970 | |||
| 27ba2411f0 | |||
| a6920855ea | |||
| c85e2401fa | |||
| 6fdcafc94a | |||
| 9bab218314 | |||
| 2854635850 | |||
| a976aa9740 | |||
| 074eb2a19d | |||
| 96812450fa | |||
| 93c688cd93 | |||
| 53afc4a9d9 | |||
| c96077590b | |||
| 6e47d0bf4a | |||
| 50b79ae0ab | |||
| 6b4709ea3c | |||
| f3a83abb54 | |||
| 33166b7357 | |||
| bb31ce1168 | |||
| dbf32933bf | |||
| af8fe182c8 | |||
| 731f0d4d01 | |||
| e42373df89 | |||
| da8050979e | |||
| 4dd1ff6dd2 | |||
| 8c403c43f0 | |||
| 2feb5c93ca | |||
| 9924a92e70 | |||
| 6c8988e445 | |||
| 9fb3b84253 | |||
| 3439862634 | |||
| 93c5455796 | |||
| e665667bff | |||
| 3ca59b8701 | |||
| fba0b359d4 | |||
| e1b6496af7 | |||
| 14620423e8 | |||
| 55a1f8ccfd | |||
| 19afe454df | |||
| 7d842cb7fc | |||
| 3137d326c5 | |||
| 12464731f1 | |||
| 269a9d8528 | |||
| c892d2767a | |||
| c8e082f296 | |||
| 51981d562b | |||
| 51b77a425a | |||
| ae3163b5e0 | |||
| af93646b3e | |||
| 64f5afe608 | |||
| fb98f939a5 | |||
| 7733f646d6 | |||
| fd69f1cd79 | |||
| ca94ff10ce | |||
| 9c3de51412 | |||
| d9dcfffce3 | |||
| dfd1372a9b | |||
| f3c670ab0c | |||
| 8aa4b5150e | |||
| ecaa16c367 | |||
| 2f8284a386 | |||
| 73cad1e784 | |||
| 0abd01e288 | |||
| b80942ec88 | |||
| 165dab8265 | |||
| 73d736d800 | |||
| 88b4076fe5 | |||
| 36396093e6 | |||
| bada3dbac6 | |||
| 9178423844 |
+1
-1
@@ -44,7 +44,7 @@ msys2-mingw32:
|
||||
<<: *mingw-defaults
|
||||
|
||||
.flatpak-defaults: &flatpak-defaults
|
||||
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
|
||||
stage: flatpak
|
||||
artifacts:
|
||||
paths:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
FROM fedora:28
|
||||
|
||||
RUN dnf -y install \
|
||||
hicolor-icon-theme \
|
||||
adwaita-icon-theme \
|
||||
atk-devel \
|
||||
at-spi2-atk-devel \
|
||||
|
||||
@@ -120,7 +120,7 @@ get_image_paintable (GtkImage *image)
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@@ -128,14 +128,14 @@ drag_begin (GtkWidget *widget,
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
gpointer data)
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="extra_buttons_box">
|
||||
<property name="visible">0</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="reply-button">
|
||||
|
||||
@@ -295,6 +295,7 @@ start_puzzle (GdkPaintable *puzzle)
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_can_focus (grid, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), grid);
|
||||
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
|
||||
|
||||
/* Add a key event controller so people can use the arrow
|
||||
* keys to move the puzzle */
|
||||
|
||||
@@ -376,7 +376,7 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
|
||||
|
||||
static void
|
||||
get_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
@@ -398,7 +398,7 @@ get_image_data (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
get_scalable_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
gpointer data)
|
||||
|
||||
@@ -966,8 +966,8 @@ background_loaded_cb (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
child = gtk_image_new_from_pixbuf (pixbuf);
|
||||
gtk_widget_show (child);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
gtk_widget_set_size_request (child, 110, 70);
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (bd->flowbox), child, -1);
|
||||
child = gtk_widget_get_parent (child);
|
||||
g_object_set_data_full (G_OBJECT (child), "filename", bd->filename, g_free);
|
||||
@@ -995,8 +995,7 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
child = gtk_image_new_from_pixbuf (pixbuf);
|
||||
gtk_widget_show (child);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
|
||||
location = "/usr/share/backgrounds/gnome";
|
||||
@@ -1081,7 +1080,7 @@ set_accel (GtkApplication *app, GtkWidget *widget)
|
||||
typedef struct
|
||||
{
|
||||
GtkTextView tv;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
} MyTextView;
|
||||
|
||||
typedef GtkTextViewClass MyTextViewClass;
|
||||
@@ -1094,18 +1093,23 @@ my_text_view_init (MyTextView *tv)
|
||||
}
|
||||
|
||||
static void
|
||||
my_tv_draw_layer (GtkTextView *widget,
|
||||
GtkTextViewLayer layer,
|
||||
cairo_t *cr)
|
||||
my_tv_snapshot_layer (GtkTextView *widget,
|
||||
GtkTextViewLayer layer,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
MyTextView *tv = (MyTextView *)widget;
|
||||
|
||||
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->pixbuf)
|
||||
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->texture)
|
||||
{
|
||||
cairo_save (cr);
|
||||
gdk_cairo_set_source_pixbuf (cr, tv->pixbuf, 0.0, 0.0);
|
||||
cairo_paint_with_alpha (cr, 0.333);
|
||||
cairo_restore (cr);
|
||||
gtk_snapshot_push_opacity (snapshot, 0.333);
|
||||
gtk_snapshot_append_texture (snapshot,
|
||||
tv->texture,
|
||||
&GRAPHENE_RECT_INIT(
|
||||
0, 0,
|
||||
gdk_texture_get_width (tv->texture),
|
||||
gdk_texture_get_height (tv->texture)
|
||||
));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1114,7 +1118,7 @@ my_tv_finalize (GObject *object)
|
||||
{
|
||||
MyTextView *tv = (MyTextView *)object;
|
||||
|
||||
g_clear_object (&tv->pixbuf);
|
||||
g_clear_object (&tv->texture);
|
||||
|
||||
G_OBJECT_CLASS (my_text_view_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -1126,20 +1130,24 @@ my_text_view_class_init (MyTextViewClass *class)
|
||||
GObjectClass *o_class = G_OBJECT_CLASS (class);
|
||||
|
||||
o_class->finalize = my_tv_finalize;
|
||||
tv_class->draw_layer = my_tv_draw_layer;
|
||||
tv_class->snapshot_layer = my_tv_snapshot_layer;
|
||||
}
|
||||
|
||||
static void
|
||||
my_text_view_set_background (MyTextView *tv, const gchar *filename)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GFile *file;
|
||||
|
||||
g_clear_object (&tv->pixbuf);
|
||||
g_clear_object (&tv->texture);
|
||||
|
||||
if (filename == NULL)
|
||||
return;
|
||||
|
||||
tv->pixbuf = gdk_pixbuf_new_from_file (filename, &error);
|
||||
file = g_file_new_for_path (filename);
|
||||
tv->texture = gdk_texture_new_from_file (file, &error);
|
||||
g_object_unref (file);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
|
||||
@@ -2226,6 +2226,9 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Save the current document</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<property name="label" translatable="yes">Search</property>
|
||||
@@ -3580,4 +3583,4 @@ bad things might happen.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
</interface>
|
||||
@@ -193,7 +193,6 @@ gdk_surface_is_visible
|
||||
gdk_surface_is_viewable
|
||||
gdk_surface_is_input_only
|
||||
gdk_surface_get_state
|
||||
gdk_surface_withdraw
|
||||
gdk_surface_iconify
|
||||
gdk_surface_deiconify
|
||||
gdk_surface_stick
|
||||
@@ -774,38 +773,60 @@ gdk_cursor_get_type
|
||||
<SECTION>
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
<FILE>dnd</FILE>
|
||||
GdkDragContext
|
||||
GdkDrag
|
||||
GdkDrop
|
||||
GdkDragCancelReason
|
||||
gdk_drag_drop_done
|
||||
gdk_drag_begin
|
||||
GdkDragAction
|
||||
GDK_ACTION_ALL
|
||||
|
||||
gdk_drag_context_get_display
|
||||
gdk_drag_context_get_actions
|
||||
gdk_drag_context_get_suggested_action
|
||||
gdk_drag_context_get_selected_action
|
||||
gdk_drag_context_get_formats
|
||||
gdk_drag_context_get_device
|
||||
gdk_drag_context_get_drag_surface
|
||||
gdk_drag_context_set_hotspot
|
||||
gdk_drag_get_display
|
||||
gdk_drag_get_actions
|
||||
gdk_drag_get_suggested_action
|
||||
gdk_drag_get_selected_action
|
||||
gdk_drag_get_formats
|
||||
gdk_drag_get_device
|
||||
gdk_drag_get_drag_surface
|
||||
gdk_drag_set_hotspot
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_drag_action_is_unique
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_drop_get_display
|
||||
gdk_drop_get_device
|
||||
gdk_drop_get_surface
|
||||
gdk_drop_get_formats
|
||||
gdk_drop_get_actions
|
||||
gdk_drop_get_drag
|
||||
gdk_drop_status
|
||||
gdk_drop_finish
|
||||
gdk_drop_read_async
|
||||
gdk_drop_read_finish
|
||||
gdk_drop_read_value_async
|
||||
gdk_drop_read_value_finish
|
||||
gdk_drop_read_text_async
|
||||
gdk_drop_read_text_finish
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAG_CONTEXT
|
||||
GDK_TYPE_DRAG_CONTEXT
|
||||
GDK_IS_DRAG_CONTEXT
|
||||
GDK_DRAG_CONTEXT_CLASS
|
||||
GDK_DRAG_CONTEXT_GET_CLASS
|
||||
GDK_IS_DRAG_CONTEXT_CLASS
|
||||
GDK_DRAG
|
||||
GDK_TYPE_DRAG
|
||||
GDK_IS_DRAG
|
||||
GDK_DRAG_CLASS
|
||||
GDK_DRAG_GET_CLASS
|
||||
GDK_IS_DRAG_CLASS
|
||||
GDK_TYPE_DRAG_ACTION
|
||||
GDK_TYPE_DRAG_PROTOCOL
|
||||
GDK_TYPE_DROP
|
||||
GDK_DROP
|
||||
GDK_IS_DROP
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkDragContextClass
|
||||
gdk_drag_context_get_type
|
||||
GdkDragClass
|
||||
gdk_drag_get_type
|
||||
GdkDropClass
|
||||
gdk_drop_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -1244,6 +1265,7 @@ gdk_clipboard_get_type
|
||||
<SECTION>
|
||||
<FILE>gdkcontentprovider</FILE>
|
||||
GdkContentProvider
|
||||
GdkContentProviderClass
|
||||
gdk_content_provider_new_for_value
|
||||
gdk_content_provider_new_for_bytes
|
||||
gdk_content_provider_ref_formats
|
||||
@@ -1259,7 +1281,6 @@ GDK_CONTENT_PROVIDER_CLASS
|
||||
GDK_CONTENT_PROVIDER_GET_CLASS
|
||||
GDK_IS_CONTENT_PROVIDER
|
||||
GDK_IS_CONTENT_PROVIDER_CLASS
|
||||
GdkContentProviderClass
|
||||
gdk_content_provider_get_type
|
||||
</SECTION>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ gdk_app_launch_context_get_type
|
||||
gdk_clipboard_get_type
|
||||
gdk_content_deserializer_get_type
|
||||
gdk_content_formats_get_type
|
||||
gdk_content_provider_get_type
|
||||
gdk_content_serializer_get_type
|
||||
gdk_cursor_get_type
|
||||
gdk_device_get_type
|
||||
@@ -9,7 +10,8 @@ gdk_device_pad_get_type
|
||||
gdk_device_tool_get_type
|
||||
gdk_display_get_type
|
||||
gdk_display_manager_get_type
|
||||
gdk_drag_context_get_type
|
||||
gdk_drag_get_type
|
||||
gdk_drop_get_type
|
||||
gdk_event_get_type
|
||||
gdk_frame_clock_get_type
|
||||
gdk_gl_context_get_type
|
||||
|
||||
@@ -385,7 +385,6 @@
|
||||
<xi:include href="osx.sgml" />
|
||||
<xi:include href="broadway.xml" />
|
||||
<xi:include href="wayland.xml" />
|
||||
<xi:include href="mir.xml" />
|
||||
</part>
|
||||
|
||||
<xi:include href="glossary.xml" />
|
||||
|
||||
@@ -679,8 +679,6 @@ 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
|
||||
gtk_combo_box_popup
|
||||
gtk_combo_box_popdown
|
||||
gtk_combo_box_get_popup_accessible
|
||||
gtk_combo_box_get_row_separator_func
|
||||
@@ -1724,8 +1722,6 @@ gtk_menu_attach
|
||||
gtk_menu_popup_at_rect
|
||||
gtk_menu_popup_at_widget
|
||||
gtk_menu_popup_at_pointer
|
||||
gtk_menu_popup_for_device
|
||||
gtk_menu_popup
|
||||
gtk_menu_set_accel_group
|
||||
gtk_menu_get_accel_group
|
||||
gtk_menu_set_accel_path
|
||||
@@ -4907,12 +4903,10 @@ gtk_render_check
|
||||
gtk_render_expander
|
||||
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
|
||||
gtk_render_insertion_cursor
|
||||
@@ -4936,7 +4930,6 @@ gtk_border_get_type
|
||||
<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
|
||||
@@ -5013,6 +5006,7 @@ gtk_selection_data_get_type
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
GtkDestDefaults
|
||||
GtkDragResult
|
||||
|
||||
<SUBSECTION Destination Side>
|
||||
gtk_drag_dest_set
|
||||
gtk_drag_dest_unset
|
||||
@@ -5028,8 +5022,9 @@ gtk_drag_get_data
|
||||
gtk_drag_get_source_widget
|
||||
gtk_drag_highlight
|
||||
gtk_drag_unhighlight
|
||||
|
||||
<SUBSECTION Source Side>
|
||||
gtk_drag_begin_with_coordinates
|
||||
gtk_drag_begin
|
||||
gtk_drag_cancel
|
||||
gtk_drag_set_icon_widget
|
||||
gtk_drag_set_icon_paintable
|
||||
@@ -6463,7 +6458,7 @@ gtk_gesture_single_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerscroll</FILE>
|
||||
<TITLE>GtkEventControlerScroll</TITLE>
|
||||
<TITLE>GtkEventControllerScroll</TITLE>
|
||||
GtkEventControllerScroll
|
||||
GtkEventControllerScrollFlags
|
||||
gtk_event_controller_scroll_new
|
||||
@@ -6484,7 +6479,7 @@ gtk_event_controller_scroll_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollermotion</FILE>
|
||||
<TITLE>GtkEventControlerMotion</TITLE>
|
||||
<TITLE>GtkEventControllerMotion</TITLE>
|
||||
GtkEventControllerMotion
|
||||
gtk_event_controller_motion_new
|
||||
|
||||
@@ -6502,7 +6497,7 @@ gtk_event_controller_motion_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerkey</FILE>
|
||||
<TITLE>GtkEventControlerKey</TITLE>
|
||||
<TITLE>GtkEventControllerKey</TITLE>
|
||||
GtkEventControllerKey
|
||||
gtk_event_controller_key_new
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ gtk_page_setup_get_type
|
||||
@DISABLE_ON_W32@gtk_page_setup_unix_dialog_get_type
|
||||
gtk_paned_get_type
|
||||
gtk_paper_size_get_type
|
||||
gtk_picture_get_type
|
||||
gtk_popover_get_type
|
||||
gtk_popover_menu_get_type
|
||||
@DISABLE_ON_W32@gtk_printer_get_type
|
||||
|
||||
@@ -355,7 +355,6 @@ content_files = [
|
||||
'input-handling.xml',
|
||||
'migrating-2to4.xml',
|
||||
'migrating-3to4.xml',
|
||||
'mir.xml',
|
||||
'osx.sgml',
|
||||
'other_software.sgml',
|
||||
'overview.xml',
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
<para>
|
||||
The steps outlined in the following sections assume that your
|
||||
application is working with GTK+ 3.22, which is the final stable
|
||||
application is working with GTK+ 3.24, which is the final stable
|
||||
release of GTK+ 3.x. It includes all the necessary APIs and tools
|
||||
to help you port your application to GTK+ 4. If you are still using
|
||||
an older version of GTK+ 3.x, you should first get your application
|
||||
to build and work with the latest minor release in the 3.22 series.
|
||||
to build and work with the latest minor release in the 3.24 series.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
@@ -34,7 +34,7 @@
|
||||
widgets have been deprecated. These deprecations are clearly spelled
|
||||
out in the API reference, with hints about the recommended replacements.
|
||||
The API reference for GTK+ 3 also includes an
|
||||
<ulink url="https://developer.gnome.org/gtk3/3.22/api-index-deprecated.html">index</ulink> of all deprecated symbols.
|
||||
<ulink url="https://developer.gnome.org/gtk3/3.24/api-index-deprecated.html">index</ulink> of all deprecated symbols.
|
||||
</para>
|
||||
<para>
|
||||
To verify that your program does not use any deprecated symbols,
|
||||
@@ -79,13 +79,13 @@
|
||||
<title>Review your window creation flags</title>
|
||||
<para>
|
||||
GTK+ 4 removes the GDK_WA_CURSOR flag. Instead, just use
|
||||
gdk_surface_set_cursor() to set a cursor on the window after
|
||||
gdk_window_set_cursor() to set a cursor on the window after
|
||||
creating it.
|
||||
</para>
|
||||
<para>
|
||||
GTK+ 4 also removes the GDK_WA_VISUAL flag, and always uses
|
||||
an RGBA visual for windows. To prepare your code for this,
|
||||
use gdk_surface_set_visual (gdk_screen_get_rgba_visual ()) after
|
||||
use gdk_window_set_visual (gdk_screen_get_rgba_visual ()) after
|
||||
creating your window.
|
||||
</para>
|
||||
<para>
|
||||
@@ -169,6 +169,14 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using GtkWidget event signals</title>
|
||||
<para>
|
||||
Event controllers and #GtkGestures replace event signals in GTK+ 4. They
|
||||
have been backported to GTK+ 3.x so you can prepare for this change.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -311,6 +319,15 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GtkWidget's size allocation changes</title>
|
||||
<para>
|
||||
The #GtkWidget::size-allocate signal now takes the baseline as an
|
||||
argument, so you no longer need to call gtk_widget_get_allocated_baseline()
|
||||
to get it.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Switch to GtkWidget's children APIs</title>
|
||||
<para>
|
||||
@@ -432,8 +449,7 @@
|
||||
<title>GtkWidget event signals are removed</title>
|
||||
<para>
|
||||
Event controllers and #GtkGestures have already been introduced in GTK+ 3 to handle
|
||||
input for many cases. In GTK+ 4, even more are available, such as #GtkEventControllerScroll
|
||||
and GtkEventControllerMotion, and the traditional widget signals for handling input,
|
||||
input for many cases. In GTK+ 4, the traditional widget signals for handling input,
|
||||
such as #GtkWidget::motion-event or #GtkWidget::event have been removed.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-mir">
|
||||
<refmeta>
|
||||
<refentrytitle>Using GTK+ with Mir</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>GTK Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>Using GTK+ with Mir</refname>
|
||||
<refpurpose>
|
||||
Mir-specific aspects of using GTK+
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Using GTK+ with Mir</title>
|
||||
|
||||
<para>
|
||||
The GDK Mir backend provides support for running GTK+ applications
|
||||
under Mir based display servers. To run your application in this way,
|
||||
select the Mir backend by setting <literal>GDK_BACKEND=mir</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, the Mir backend does not use any additional commandline
|
||||
options or environment variables.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
@@ -435,11 +435,6 @@ nevertheless.
|
||||
<listitem><para>Selects the Wayland backend for connecting to Wayland display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>mir</term>
|
||||
<listitem><para>Selects the Mir backend for connecting to Mir display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
Since 3.10, this environment variable can contain a comma-separated list
|
||||
of backend names, which are tried in order. The list may also contain
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkproperty.h"
|
||||
@@ -34,56 +34,56 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ())
|
||||
#define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
|
||||
#define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
|
||||
#define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
|
||||
#define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
|
||||
#define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
|
||||
#define GDK_TYPE_BROADWAY_DRAG (gdk_broadway_drag_get_type ())
|
||||
#define GDK_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDrag))
|
||||
#define GDK_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
|
||||
#define GDK_IS_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG))
|
||||
#define GDK_IS_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG))
|
||||
#define GDK_BROADWAY_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
|
||||
|
||||
#ifdef GDK_COMPILATION
|
||||
typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
|
||||
typedef struct _GdkBroadwayDrag GdkBroadwayDrag;
|
||||
#else
|
||||
typedef GdkDragContext GdkBroadwayDragContext;
|
||||
typedef GdkDrag GdkBroadwayDrag;
|
||||
#endif
|
||||
typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
|
||||
typedef struct _GdkBroadwayDragClass GdkBroadwayDragClass;
|
||||
|
||||
GType gdk_broadway_drag_context_get_type (void);
|
||||
GType gdk_broadway_drag_get_type (void);
|
||||
|
||||
struct _GdkBroadwayDragContext {
|
||||
GdkDragContext context;
|
||||
struct _GdkBroadwayDrag {
|
||||
GdkDrag context;
|
||||
};
|
||||
|
||||
struct _GdkBroadwayDragContextClass
|
||||
struct _GdkBroadwayDragClass
|
||||
{
|
||||
GdkDragContextClass parent_class;
|
||||
GdkDragClass parent_class;
|
||||
};
|
||||
|
||||
static void gdk_broadway_drag_context_finalize (GObject *object);
|
||||
static void gdk_broadway_drag_finalize (GObject *object);
|
||||
|
||||
static GList *contexts;
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
G_DEFINE_TYPE (GdkBroadwayDrag, gdk_broadway_drag, GDK_TYPE_DRAG)
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
|
||||
gdk_broadway_drag_init (GdkBroadwayDrag *dragcontext)
|
||||
{
|
||||
contexts = g_list_prepend (contexts, dragcontext);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_finalize (GObject *object)
|
||||
gdk_broadway_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
GdkDrag *context = GDK_DRAG (object);
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
|
||||
G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_broadway_drag_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/* Drag Contexts */
|
||||
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
@@ -91,12 +91,12 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkDragContext *new_context;
|
||||
GdkDrag *new_context;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
g_return_val_if_fail (GDK_SURFACE_IS_BROADWAY (surface), NULL);
|
||||
|
||||
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
|
||||
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
@@ -104,20 +104,6 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
return new_context;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
|
||||
guint32 time)
|
||||
{
|
||||
g_return_if_fail (context != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
|
||||
guint32 time)
|
||||
{
|
||||
g_return_if_fail (context != NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_surface_register_dnd (GdkSurface *surface)
|
||||
{
|
||||
@@ -129,13 +115,9 @@ _gdk_broadway_display_init_dnd (GdkDisplay *display)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
|
||||
gdk_broadway_drag_class_init (GdkBroadwayDragClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_broadway_drag_context_finalize;
|
||||
|
||||
context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
|
||||
object_class->finalize = gdk_broadway_drag_finalize;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void gdk_broadway_surface_set_nodes (GdkSurface *surface,
|
||||
GPtrArray *node_textures);
|
||||
|
||||
void _gdk_broadway_surface_register_dnd (GdkSurface *surface);
|
||||
GdkDragContext * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
|
||||
@@ -322,10 +322,7 @@ gdk_surface_broadway_show (GdkSurface *surface,
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl->visible = TRUE;
|
||||
|
||||
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
|
||||
|
||||
if (surface->parent)
|
||||
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
|
||||
/* FIXME: update state ? */
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
if (_gdk_broadway_server_surface_show (broadway_display->server, impl->id))
|
||||
@@ -342,10 +339,7 @@ gdk_surface_broadway_hide (GdkSurface *surface)
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl->visible = FALSE;
|
||||
|
||||
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
|
||||
|
||||
if (surface->parent)
|
||||
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
|
||||
/* FIXME: update state ? */
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
|
||||
|
||||
+12
-12
@@ -43,8 +43,19 @@ clienthtml_h = custom_target('clienthtml.h',
|
||||
],
|
||||
)
|
||||
|
||||
broadwayjs_h = custom_target('broadwayjs.h',
|
||||
input : ['broadway.js'],
|
||||
output : 'broadwayjs.h',
|
||||
command : [
|
||||
gen_c_array,
|
||||
'--array-name=broadway_js',
|
||||
'--output=@OUTPUT@',
|
||||
'@INPUT0@',
|
||||
],
|
||||
)
|
||||
|
||||
libgdk_broadway = static_library('gdk-broadway',
|
||||
clienthtml_h,
|
||||
clienthtml_h, broadwayjs_h,
|
||||
gdk_broadway_sources, gdkconfig, gdkenum_h,
|
||||
include_directories: [confinc, gdkinc],
|
||||
c_args: [
|
||||
@@ -58,17 +69,6 @@ libgdk_broadway = static_library('gdk-broadway',
|
||||
|
||||
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
|
||||
|
||||
broadwayjs_h = custom_target('broadwayjs.h',
|
||||
input : ['broadway.js'],
|
||||
output : 'broadwayjs.h',
|
||||
command : [
|
||||
gen_c_array,
|
||||
'--array-name=broadway_js',
|
||||
'--output=@OUTPUT@',
|
||||
'@INPUT0@',
|
||||
],
|
||||
)
|
||||
|
||||
executable('gtk4-broadwayd',
|
||||
clienthtml_h, broadwayjs_h,
|
||||
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
|
||||
|
||||
@@ -23,11 +23,12 @@
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDragContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
#include <gdk/gdkdisplay.h>
|
||||
#include <gdk/gdkdisplaymanager.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdrawcontext.h>
|
||||
#include <gdk/gdkdrop.h>
|
||||
#include <gdk/gdkenumtypes.h>
|
||||
|
||||
@@ -716,8 +716,7 @@ file_uri_deserializer_finish (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
str = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (
|
||||
g_filter_output_stream_get_base_stream (G_FILTER_OUTPUT_STREAM (stream))));
|
||||
str = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (stream));
|
||||
uris = g_uri_list_extract_uris (str);
|
||||
g_free (str);
|
||||
|
||||
@@ -738,6 +737,8 @@ file_uri_deserializer_finish (GObject *source,
|
||||
g_value_take_boxed (value, g_slist_reverse (l));
|
||||
}
|
||||
g_strfreev (uris);
|
||||
|
||||
gdk_content_deserializer_return_success (deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+1
-18
@@ -61,12 +61,7 @@
|
||||
* the commonly available names that are shared with the CSS specification.
|
||||
* Other names may be available, depending on the platform in use.
|
||||
* Another option to create a cursor is to use gdk_cursor_new_from_texture()
|
||||
* and provide an image to use for the cursor. Depending on the #GdkDisplay
|
||||
* in use, the type of supported images may be limited. See
|
||||
* gdk_display_supports_cursor_alpha(),
|
||||
* gdk_display_supports_cursor_color(),
|
||||
* gdk_display_get_default_cursor_size() and
|
||||
* gdk_display_get_maximal_cursor_size() for the limitations that might apply.
|
||||
* and provide an image to use for the cursor.
|
||||
*
|
||||
* To ease work with unsupported cursors, a fallback cursor can be provided.
|
||||
* If a #GdkSurface cannot use a cursor because of the reasons mentioned above,
|
||||
@@ -346,18 +341,6 @@ gdk_cursor_new_from_name (const gchar *name,
|
||||
*
|
||||
* Creates a new cursor from a #GdkTexture.
|
||||
*
|
||||
* Not all GDK backends support RGBA cursors. If they are not
|
||||
* supported, a monochrome approximation will be displayed.
|
||||
* The functions gdk_display_supports_cursor_alpha() and
|
||||
* gdk_display_supports_cursor_color() can be used to determine
|
||||
* whether RGBA cursors are supported;
|
||||
* gdk_display_get_default_cursor_size() and
|
||||
* gdk_display_get_maximal_cursor_size() give information about
|
||||
* cursor sizes.
|
||||
*
|
||||
* On the X backend, support for RGBA cursors requires a
|
||||
* sufficently new version of the X Render extension.
|
||||
*
|
||||
* Returns: a new #GdkCursor.
|
||||
*/
|
||||
GdkCursor *
|
||||
|
||||
+1
-1
@@ -1282,7 +1282,7 @@ gdk_display_notify_startup_complete (GdkDisplay *display,
|
||||
|
||||
/**
|
||||
* gdk_display_get_startup_notification_id:
|
||||
* @display: (type GdkX11Display): a #GdkDisplay
|
||||
* @display: a #GdkDisplay
|
||||
*
|
||||
* Gets the startup notification ID for a Wayland display, or %NULL
|
||||
* if no ID has been defined.
|
||||
|
||||
-100
@@ -1,100 +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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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_DND_H__
|
||||
#define __GDK_DND_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
|
||||
#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
|
||||
#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
|
||||
|
||||
/**
|
||||
* GdkDragCancelReason:
|
||||
* @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
|
||||
* @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
|
||||
* @GDK_DRAG_CANCEL_ERROR: Unspecified error.
|
||||
*
|
||||
* Used in #GdkDragContext to the reason of a cancelled DND operation.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DRAG_CANCEL_NO_TARGET,
|
||||
GDK_DRAG_CANCEL_USER_CANCELLED,
|
||||
GDK_DRAG_CANCEL_ERROR
|
||||
} GdkDragCancelReason;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_drag_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_drag_context_get_display (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_drag_context_get_device (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats *gdk_drag_context_get_formats (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
|
||||
/* Source side */
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext * gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_drop_done (GdkDragContext *context,
|
||||
gboolean success);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *gdk_drag_context_get_drag_surface (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
||||
@@ -1,105 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2010, Red Hat, Inc
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DND_PRIVATE_H__
|
||||
#define __GDK_DND_PRIVATE_H__
|
||||
|
||||
#include "gdkdnd.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
|
||||
#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
|
||||
#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
|
||||
|
||||
typedef struct _GdkDragContextClass GdkDragContextClass;
|
||||
|
||||
|
||||
struct _GdkDragContextClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*drag_abort) (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
void (*drag_drop) (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
|
||||
void (*set_hotspot) (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
void (*drop_done) (GdkDragContext *context,
|
||||
gboolean success);
|
||||
|
||||
void (*set_cursor) (GdkDragContext *context,
|
||||
GdkCursor *cursor);
|
||||
void (*cancel) (GdkDragContext *context,
|
||||
GdkDragCancelReason reason);
|
||||
void (*drop_performed) (GdkDragContext *context,
|
||||
guint32 time);
|
||||
void (*dnd_finished) (GdkDragContext *context);
|
||||
|
||||
gboolean (*handle_event) (GdkDragContext *context,
|
||||
const GdkEvent *event);
|
||||
void (*action_changed) (GdkDragContext *context,
|
||||
GdkDragAction action);
|
||||
};
|
||||
|
||||
struct _GdkDragContext {
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GdkSurface *source_surface;
|
||||
GdkSurface *drag_surface;
|
||||
|
||||
GdkContentProvider *content;
|
||||
GdkDragAction action;
|
||||
|
||||
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
|
||||
};
|
||||
|
||||
void gdk_drag_context_set_cursor (GdkDragContext *context,
|
||||
GdkCursor *cursor);
|
||||
void gdk_drag_context_set_actions (GdkDragContext *context,
|
||||
GdkDragAction actions,
|
||||
GdkDragAction suggested_action);
|
||||
|
||||
void gdk_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason);
|
||||
gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
|
||||
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
|
||||
GdkDragAction action);
|
||||
|
||||
void gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
void gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time_);
|
||||
|
||||
void gdk_drag_context_write_async (GdkDragContext *context,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean gdk_drag_context_write_finish (GdkDragContext *context,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
+275
-251
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdkintl.h"
|
||||
@@ -35,17 +35,6 @@
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
|
||||
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
|
||||
|
||||
struct _GdkDragContextPrivate
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDevice *device;
|
||||
GdkContentFormats *formats;
|
||||
GdkDragAction actions;
|
||||
GdkDragAction suggested_action;
|
||||
};
|
||||
|
||||
static struct {
|
||||
GdkDragAction action;
|
||||
const gchar *name;
|
||||
@@ -64,6 +53,9 @@ enum {
|
||||
PROP_DEVICE,
|
||||
PROP_DISPLAY,
|
||||
PROP_FORMATS,
|
||||
PROP_SELECTED_ACTION,
|
||||
PROP_ACTIONS,
|
||||
PROP_SURFACE,
|
||||
N_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -71,15 +63,30 @@ enum {
|
||||
CANCEL,
|
||||
DROP_PERFORMED,
|
||||
DND_FINISHED,
|
||||
ACTION_CHANGED,
|
||||
N_SIGNALS
|
||||
};
|
||||
|
||||
typedef struct _GdkDragPrivate GdkDragPrivate;
|
||||
|
||||
struct _GdkDragPrivate {
|
||||
GdkSurface *surface;
|
||||
|
||||
GdkDisplay *display;
|
||||
GdkDevice *device;
|
||||
GdkContentFormats *formats;
|
||||
GdkContentProvider *content;
|
||||
|
||||
GdkDragAction actions;
|
||||
GdkDragAction selected_action;
|
||||
|
||||
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GList *contexts = NULL;
|
||||
static GList *drags = NULL;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
* SECTION:dnd
|
||||
@@ -87,153 +94,139 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OB
|
||||
* @short_description: Functions for controlling drag and drop handling
|
||||
*
|
||||
* These functions provide a low level interface for drag and drop.
|
||||
* The X backend of GDK supports both the Xdnd and Motif drag and drop
|
||||
* protocols transparently, the Win32 backend supports the WM_DROPFILES
|
||||
* protocol.
|
||||
*
|
||||
* The GdkDrag object represents the source side of an ongoing DND operation.
|
||||
* It is created when a drag is started, and stays alive for duration of
|
||||
* the DND operation.
|
||||
*
|
||||
* The GdkDrop object represents the target side of an ongoing DND operation.
|
||||
*
|
||||
* GTK+ provides a higher level abstraction based on top of these functions,
|
||||
* and so they are not normally needed in GTK+ applications.
|
||||
* See the [Drag and Drop][gtk3-Drag-and-Drop] section of
|
||||
* the GTK+ documentation for more information.
|
||||
* and so they are not normally needed in GTK+ applications. See the
|
||||
* [Drag and Drop][gtk4-Drag-and-Drop] section of the GTK+ documentation
|
||||
* for more information.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GdkDragContext:
|
||||
* GdkDrag:
|
||||
*
|
||||
* The GdkDragContext struct contains only private fields and
|
||||
* The GdkDrag struct contains only private fields and
|
||||
* should not be accessed directly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_display:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_display:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Gets the #GdkDisplay that the drag context was created for.
|
||||
* Gets the #GdkDisplay that the drag object was created for.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkDisplay
|
||||
**/
|
||||
GdkDisplay *
|
||||
gdk_drag_context_get_display (GdkDragContext *context)
|
||||
gdk_drag_get_display (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
return priv->display;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_formats:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_formats:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Retrieves the formats supported by this context.
|
||||
* Retrieves the formats supported by this GdkDrag object.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkContentFormats
|
||||
**/
|
||||
GdkContentFormats *
|
||||
gdk_drag_context_get_formats (GdkDragContext *context)
|
||||
gdk_drag_get_formats (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
return priv->formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_actions:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_actions:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Determines the bitmask of actions proposed by the source if
|
||||
* gdk_drag_context_get_suggested_action() returns %GDK_ACTION_ASK.
|
||||
* Determines the bitmask of possible actions proposed by the source.
|
||||
*
|
||||
* Returns: the #GdkDragAction flags
|
||||
**/
|
||||
GdkDragAction
|
||||
gdk_drag_context_get_actions (GdkDragContext *context)
|
||||
gdk_drag_get_actions (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
|
||||
|
||||
return priv->actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_suggested_action:
|
||||
* @context: a #GdkDragContext
|
||||
*
|
||||
* Determines the suggested drag action of the context.
|
||||
*
|
||||
* Returns: a #GdkDragAction value
|
||||
**/
|
||||
GdkDragAction
|
||||
gdk_drag_context_get_suggested_action (GdkDragContext *context)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
|
||||
|
||||
return priv->suggested_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_selected_action:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_selected_action:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Determines the action chosen by the drag destination.
|
||||
*
|
||||
* Returns: a #GdkDragAction value
|
||||
**/
|
||||
GdkDragAction
|
||||
gdk_drag_context_get_selected_action (GdkDragContext *context)
|
||||
gdk_drag_get_selected_action (GdkDrag *drag)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
return context->action;
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
|
||||
|
||||
return priv->selected_action;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_device:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_device:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Returns the #GdkDevice associated to the drag context.
|
||||
* Returns the #GdkDevice associated to the GdkDrag object.
|
||||
*
|
||||
* Returns: (transfer none): The #GdkDevice associated to @context.
|
||||
* Returns: (transfer none): The #GdkDevice associated to @drag.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_drag_context_get_device (GdkDragContext *context)
|
||||
gdk_drag_get_device (GdkDrag *drag)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
return priv->device;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_init (GdkDragContext *context)
|
||||
gdk_drag_init (GdkDrag *drag)
|
||||
{
|
||||
contexts = g_list_prepend (contexts, context);
|
||||
drags = g_list_prepend (drags, drag);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gdk_drag_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDrag *drag = GDK_DRAG (gobject);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
context->content = g_value_dup_object (value);
|
||||
if (context->content)
|
||||
priv->content = g_value_dup_object (value);
|
||||
if (priv->content)
|
||||
{
|
||||
g_assert (priv->formats == NULL);
|
||||
priv->formats = gdk_content_provider_ref_formats (context->content);
|
||||
priv->formats = gdk_content_provider_ref_formats (priv->content);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -260,6 +253,25 @@ gdk_drag_context_set_property (GObject *gobject,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SELECTED_ACTION:
|
||||
{
|
||||
GdkDragAction action = g_value_get_flags (value);
|
||||
gdk_drag_set_selected_action (drag, action);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ACTIONS:
|
||||
{
|
||||
GdkDragAction actions = g_value_get_flags (value);
|
||||
gdk_drag_set_actions (drag, actions);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
priv->surface = g_value_dup_object (value);
|
||||
g_assert (priv->surface != NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@@ -267,18 +279,18 @@ gdk_drag_context_set_property (GObject *gobject,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gdk_drag_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDrag *drag = GDK_DRAG (gobject);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_CONTENT:
|
||||
g_value_set_object (value, context->content);
|
||||
g_value_set_object (value, priv->content);
|
||||
break;
|
||||
|
||||
case PROP_DEVICE:
|
||||
@@ -293,6 +305,18 @@ gdk_drag_context_get_property (GObject *gobject,
|
||||
g_value_set_boxed (value, priv->formats);
|
||||
break;
|
||||
|
||||
case PROP_SELECTED_ACTION:
|
||||
g_value_set_flags (value, priv->selected_action);
|
||||
break;
|
||||
|
||||
case PROP_ACTIONS:
|
||||
g_value_set_flags (value, priv->actions);
|
||||
break;
|
||||
|
||||
case PROP_SURFACE:
|
||||
g_value_set_object (value, priv->surface);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@@ -300,36 +324,34 @@ gdk_drag_context_get_property (GObject *gobject,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_finalize (GObject *object)
|
||||
gdk_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDrag *drag = GDK_DRAG (object);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
drags = g_list_remove (drags, drag);
|
||||
|
||||
g_clear_object (&context->content);
|
||||
g_clear_object (&priv->content);
|
||||
g_clear_pointer (&priv->formats, gdk_content_formats_unref);
|
||||
|
||||
if (context->source_surface)
|
||||
g_object_unref (context->source_surface);
|
||||
g_clear_object (&priv->surface);
|
||||
|
||||
G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_drag_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
gdk_drag_class_init (GdkDragClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = gdk_drag_context_get_property;
|
||||
object_class->set_property = gdk_drag_context_set_property;
|
||||
object_class->finalize = gdk_drag_context_finalize;
|
||||
object_class->get_property = gdk_drag_get_property;
|
||||
object_class->set_property = gdk_drag_set_property;
|
||||
object_class->finalize = gdk_drag_finalize;
|
||||
|
||||
/**
|
||||
* GdkDragContext:content:
|
||||
* GdkDrag:content:
|
||||
*
|
||||
* The #GdkContentProvider or %NULL if the context is not a source-side
|
||||
* context.
|
||||
* The #GdkContentProvider.
|
||||
*/
|
||||
properties[PROP_CONTENT] =
|
||||
g_param_spec_object ("content",
|
||||
@@ -342,7 +364,7 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext:device:
|
||||
* GdkDrag:device:
|
||||
*
|
||||
* The #GdkDevice that is performing the drag.
|
||||
*/
|
||||
@@ -357,9 +379,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext:display:
|
||||
* GdkDrag:display:
|
||||
*
|
||||
* The #GdkDisplay that the drag context belongs to.
|
||||
* The #GdkDisplay that the drag belongs to.
|
||||
*/
|
||||
properties[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
@@ -371,9 +393,9 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext:formats:
|
||||
* GdkDrag:formats:
|
||||
*
|
||||
* The possible formats that the context can provide its data in.
|
||||
* The possible formats that the drag can provide its data in.
|
||||
*/
|
||||
properties[PROP_FORMATS] =
|
||||
g_param_spec_boxed ("formats",
|
||||
@@ -385,113 +407,91 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
properties[PROP_SELECTED_ACTION] =
|
||||
g_param_spec_flags ("selected-action",
|
||||
"Selected action",
|
||||
"The currently selected action",
|
||||
GDK_TYPE_DRAG_ACTION,
|
||||
0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
properties[PROP_ACTIONS] =
|
||||
g_param_spec_flags ("actions",
|
||||
"Actions",
|
||||
"The possible actions",
|
||||
GDK_TYPE_DRAG_ACTION,
|
||||
0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
properties[PROP_SURFACE] =
|
||||
g_param_spec_object ("surface",
|
||||
"Surface",
|
||||
"The surface where the drag originates",
|
||||
GDK_TYPE_SURFACE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkDragContext::cancel:
|
||||
* @context: The object on which the signal is emitted
|
||||
* @reason: The reason the context was cancelled
|
||||
* GdkDrag::cancel:
|
||||
* @drag: The object on which the signal is emitted
|
||||
* @reason: The reason the drag was cancelled
|
||||
*
|
||||
* The drag and drop operation was cancelled.
|
||||
* The drag operation was cancelled.
|
||||
*/
|
||||
signals[CANCEL] =
|
||||
g_signal_new (g_intern_static_string ("cancel"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, cancel),
|
||||
G_STRUCT_OFFSET (GdkDragClass, cancel),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__ENUM,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_DRAG_CANCEL_REASON);
|
||||
|
||||
/**
|
||||
* GdkDragContext::drop-performed:
|
||||
* @context: The object on which the signal is emitted
|
||||
* GdkDrag::drop-performed:
|
||||
* @drag: The object on which the signal is emitted
|
||||
*
|
||||
* The drag and drop operation was performed on an accepting client.
|
||||
* The drag operation was performed on an accepting client.
|
||||
*/
|
||||
signals[DROP_PERFORMED] =
|
||||
g_signal_new (g_intern_static_string ("drop-performed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, drop_performed),
|
||||
G_STRUCT_OFFSET (GdkDragClass, drop_performed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GdkDragContext::dnd-finished:
|
||||
* @context: The object on which the signal is emitted
|
||||
* GdkDrag::dnd-finished:
|
||||
* @drag: The object on which the signal is emitted
|
||||
*
|
||||
* The drag and drop operation was finished, the drag destination
|
||||
* finished reading all data. The drag source can now free all
|
||||
* miscellaneous data.
|
||||
* The drag operation was finished, the destination
|
||||
* finished reading all data. The drag object can now
|
||||
* free all miscellaneous data.
|
||||
*/
|
||||
signals[DND_FINISHED] =
|
||||
g_signal_new (g_intern_static_string ("dnd-finished"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, dnd_finished),
|
||||
G_STRUCT_OFFSET (GdkDragClass, dnd_finished),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GdkDragContext::action-changed:
|
||||
* @context: The object on which the signal is emitted
|
||||
* @action: The action currently chosen
|
||||
*
|
||||
* A new action is being chosen for the drag and drop operation.
|
||||
*/
|
||||
signals[ACTION_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("action-changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkDragContextClass, action_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__FLAGS,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_DRAG_ACTION);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdk_drag_abort:
|
||||
* @context: a #GdkDragContext
|
||||
* @time_: the timestamp for this operation
|
||||
*
|
||||
* Aborts a drag without dropping.
|
||||
*
|
||||
* This function is called by the drag source.
|
||||
*/
|
||||
void
|
||||
gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time_)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_abort (context, time_);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdk_drag_drop:
|
||||
* @context: a #GdkDragContext
|
||||
* @time_: the timestamp for this operation
|
||||
*
|
||||
* Drops on the current destination.
|
||||
*
|
||||
* This function is called by the drag source.
|
||||
*/
|
||||
void
|
||||
gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time_)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_drop (context, time_);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_write_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
gdk_drag_write_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -504,9 +504,9 @@ gdk_drag_context_write_done (GObject *content,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drag_context_write_serialize_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
gdk_drag_write_serialize_done (GObject *content,
|
||||
GAsyncResult *result,
|
||||
gpointer task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -519,39 +519,40 @@ gdk_drag_context_write_serialize_done (GObject *content,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_write_async (GdkDragContext *context,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
gdk_drag_write_async (GdkDrag *drag,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
GdkContentFormats *formats, *mime_formats;
|
||||
GTask *task;
|
||||
GType gtype;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (context->content);
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
g_return_if_fail (priv->content);
|
||||
g_return_if_fail (mime_type != NULL);
|
||||
g_return_if_fail (mime_type == g_intern_string (mime_type));
|
||||
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
|
||||
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
task = g_task_new (context, cancellable, callback, user_data);
|
||||
task = g_task_new (drag, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
g_task_set_source_tag (task, gdk_drag_context_write_async);
|
||||
g_task_set_source_tag (task, gdk_drag_write_async);
|
||||
|
||||
formats = gdk_content_provider_ref_formats (context->content);
|
||||
formats = gdk_content_provider_ref_formats (priv->content);
|
||||
if (gdk_content_formats_contain_mime_type (formats, mime_type))
|
||||
{
|
||||
gdk_content_provider_write_mime_type_async (context->content,
|
||||
gdk_content_provider_write_mime_type_async (priv->content,
|
||||
mime_type,
|
||||
stream,
|
||||
io_priority,
|
||||
cancellable,
|
||||
gdk_drag_context_write_done,
|
||||
gdk_drag_write_done,
|
||||
task);
|
||||
gdk_content_formats_unref (formats);
|
||||
return;
|
||||
@@ -568,14 +569,14 @@ gdk_drag_context_write_async (GdkDragContext *context,
|
||||
g_assert (gtype != G_TYPE_INVALID);
|
||||
|
||||
g_value_init (&value, gtype);
|
||||
if (gdk_content_provider_get_value (context->content, &value, &error))
|
||||
if (gdk_content_provider_get_value (priv->content, &value, &error))
|
||||
{
|
||||
gdk_content_serialize_async (stream,
|
||||
mime_type,
|
||||
&value,
|
||||
io_priority,
|
||||
cancellable,
|
||||
gdk_drag_context_write_serialize_done,
|
||||
gdk_drag_write_serialize_done,
|
||||
g_object_ref (task));
|
||||
}
|
||||
else
|
||||
@@ -597,54 +598,75 @@ gdk_drag_context_write_async (GdkDragContext *context,
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_drag_context_write_finish (GdkDragContext *context,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
gdk_drag_write_finish (GdkDrag *drag,
|
||||
GAsyncResult *result,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (g_task_is_valid (result, context), FALSE);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_context_write_async, FALSE);
|
||||
g_return_val_if_fail (g_task_is_valid (result, drag), FALSE);
|
||||
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_write_async, FALSE);
|
||||
|
||||
return g_task_propagate_boolean (G_TASK (result), error);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_set_actions (GdkDragContext *context,
|
||||
GdkDragAction actions,
|
||||
GdkDragAction suggested_action)
|
||||
gdk_drag_set_actions (GdkDrag *drag,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
if (priv->actions == actions)
|
||||
return;
|
||||
|
||||
priv->actions = actions;
|
||||
priv->suggested_action = suggested_action;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_ACTIONS]);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_set_selected_action (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
GdkCursor *cursor;
|
||||
|
||||
if (priv->selected_action == action)
|
||||
return;
|
||||
|
||||
priv->selected_action = action;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, action);
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_SELECTED_ACTION]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_get_drag_surface:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_get_drag_surface:
|
||||
* @drag: a #GdkDrag
|
||||
*
|
||||
* Returns the surface on which the drag icon should be rendered
|
||||
* during the drag operation. Note that the surface may not be
|
||||
* available until the drag operation has begun. GDK will move
|
||||
* the surface in accordance with the ongoing drag operation.
|
||||
* The surface is owned by @context and will be destroyed when
|
||||
* The surface is owned by @drag and will be destroyed when
|
||||
* the drag operation is over.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the drag surface, or %NULL
|
||||
*/
|
||||
GdkSurface *
|
||||
gdk_drag_context_get_drag_surface (GdkDragContext *context)
|
||||
gdk_drag_get_drag_surface (GdkDrag *drag)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface)
|
||||
return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface (context);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->get_drag_surface)
|
||||
return GDK_DRAG_GET_CLASS (drag)->get_drag_surface (drag);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_set_hotspot:
|
||||
* @context: a #GdkDragContext
|
||||
* gdk_drag_set_hotspot:
|
||||
* @drag: a #GdkDrag
|
||||
* @hot_x: x coordinate of the drag surface hotspot
|
||||
* @hot_y: y coordinate of the drag surface hotspot
|
||||
*
|
||||
@@ -653,19 +675,19 @@ gdk_drag_context_get_drag_surface (GdkDragContext *context)
|
||||
* top left corner of the drag surface.
|
||||
*/
|
||||
void
|
||||
gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
gdk_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot (context, hot_x, hot_y);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->set_hotspot)
|
||||
GDK_DRAG_GET_CLASS (drag)->set_hotspot (drag, hot_x, hot_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_drop_done:
|
||||
* @context: a #GdkDragContext
|
||||
* @drag: a #GdkDrag
|
||||
* @success: whether the drag was ultimatively successful
|
||||
*
|
||||
* Inform GDK if the drop ended successfully. Passing %FALSE
|
||||
@@ -673,60 +695,62 @@ gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
*
|
||||
* This function is called by the drag source, and should
|
||||
* be the last call before dropping the reference to the
|
||||
* @context.
|
||||
* @drag.
|
||||
*
|
||||
* The #GdkDragContext will only take the first gdk_drag_drop_done()
|
||||
* The #GdkDrag will only take the first gdk_drag_drop_done()
|
||||
* call as effective, if this function is called multiple times,
|
||||
* all subsequent calls will be ignored.
|
||||
*/
|
||||
void
|
||||
gdk_drag_drop_done (GdkDragContext *context,
|
||||
gboolean success)
|
||||
gdk_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
|
||||
|
||||
if (context->drop_done)
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
if (priv->drop_done)
|
||||
return;
|
||||
|
||||
context->drop_done = TRUE;
|
||||
priv->drop_done = TRUE;
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done (context, success);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->drop_done)
|
||||
GDK_DRAG_GET_CLASS (drag)->drop_done (drag, success);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_set_cursor (GdkDragContext *context,
|
||||
GdkCursor *cursor)
|
||||
gdk_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor (context, cursor);
|
||||
if (GDK_DRAG_GET_CLASS (drag)->set_cursor)
|
||||
GDK_DRAG_GET_CLASS (drag)->set_cursor (drag, cursor);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason)
|
||||
gdk_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
g_return_if_fail (GDK_IS_DRAG (drag));
|
||||
|
||||
g_signal_emit (context, signals[CANCEL], 0, reason);
|
||||
g_signal_emit (drag, signals[CANCEL], 0, reason);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_drag_context_handle_source_event (GdkEvent *event)
|
||||
gdk_drag_handle_source_event (GdkEvent *event)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GList *l;
|
||||
|
||||
for (l = contexts; l; l = l->next)
|
||||
for (l = drags; l; l = l->next)
|
||||
{
|
||||
context = l->data;
|
||||
drag = l->data;
|
||||
|
||||
if (!GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event)
|
||||
if (!GDK_DRAG_GET_CLASS (drag)->handle_event)
|
||||
continue;
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event (context, event))
|
||||
if (GDK_DRAG_GET_CLASS (drag)->handle_event (drag, event))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -734,8 +758,8 @@ gdk_drag_context_handle_source_event (GdkEvent *event)
|
||||
}
|
||||
|
||||
GdkCursor *
|
||||
gdk_drag_get_cursor (GdkDragContext *context,
|
||||
GdkDragAction action)
|
||||
gdk_drag_get_cursor (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
gint i;
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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_DND_H__
|
||||
#define __GDK_DND_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DRAG (gdk_drag_get_type ())
|
||||
#define GDK_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG, GdkDrag))
|
||||
#define GDK_IS_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG))
|
||||
|
||||
/**
|
||||
* GdkDragCancelReason:
|
||||
* @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
|
||||
* @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
|
||||
* @GDK_DRAG_CANCEL_ERROR: Unspecified error.
|
||||
*
|
||||
* Used in #GdkDrag to the reason of a cancelled DND operation.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DRAG_CANCEL_NO_TARGET,
|
||||
GDK_DRAG_CANCEL_USER_CANCELLED,
|
||||
GDK_DRAG_CANCEL_ERROR
|
||||
} GdkDragCancelReason;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_drag_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_drag_get_display (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_drag_get_device (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkContentFormats *gdk_drag_get_formats (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_get_actions (GdkDrag *drag);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDrag * gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface *gdk_drag_get_drag_surface (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
||||
@@ -0,0 +1,86 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2010, Red Hat, Inc
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DND_PRIVATE_H__
|
||||
#define __GDK_DND_PRIVATE_H__
|
||||
|
||||
#include "gdkdrag.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG, GdkDragClass))
|
||||
#define GDK_IS_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG))
|
||||
#define GDK_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG, GdkDragClass))
|
||||
|
||||
typedef struct _GdkDragClass GdkDragClass;
|
||||
|
||||
|
||||
struct _GdkDragClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
GdkSurface* (*get_drag_surface) (GdkDrag *drag);
|
||||
void (*set_hotspot) (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
void (*drop_done) (GdkDrag *drag,
|
||||
gboolean success);
|
||||
|
||||
void (*set_cursor) (GdkDrag *drag,
|
||||
GdkCursor *cursor);
|
||||
void (*cancel) (GdkDrag *drag,
|
||||
GdkDragCancelReason reason);
|
||||
void (*drop_performed) (GdkDrag *drag,
|
||||
guint32 time);
|
||||
void (*dnd_finished) (GdkDrag *drag);
|
||||
|
||||
gboolean (*handle_event) (GdkDrag *drag,
|
||||
const GdkEvent *event);
|
||||
};
|
||||
|
||||
struct _GdkDrag {
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
void gdk_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor);
|
||||
void gdk_drag_set_actions (GdkDrag *drag,
|
||||
GdkDragAction actions);
|
||||
void gdk_drag_set_selected_action (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
|
||||
void gdk_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason);
|
||||
gboolean gdk_drag_handle_source_event (GdkEvent *event);
|
||||
GdkCursor * gdk_drag_get_cursor (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
|
||||
void gdk_drag_write_async (GdkDrag *drag,
|
||||
const char *mime_type,
|
||||
GOutputStream *stream,
|
||||
int io_priority,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean gdk_drag_write_finish (GdkDrag *drag,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
+18
-7
@@ -38,7 +38,7 @@ typedef struct _GdkDropPrivate GdkDropPrivate;
|
||||
|
||||
struct _GdkDropPrivate {
|
||||
GdkDevice *device;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *formats;
|
||||
GdkSurface *surface;
|
||||
GdkDragAction actions;
|
||||
@@ -78,7 +78,7 @@ gdk_drop_read_local_write_done (GObject *drag,
|
||||
gpointer stream)
|
||||
{
|
||||
/* we don't care about the error, we just want to clean up */
|
||||
gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (drag), result, NULL);
|
||||
gdk_drag_write_finish (GDK_DRAG (drag), result, NULL);
|
||||
|
||||
/* XXX: Do we need to close_async() here? */
|
||||
g_output_stream_close (stream, NULL, NULL);
|
||||
@@ -98,6 +98,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
GdkContentFormats *content_formats;
|
||||
const char *mime_type;
|
||||
GTask *task;
|
||||
GdkContentProvider *content;
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
g_task_set_priority (task, io_priority);
|
||||
@@ -111,7 +112,9 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
return;
|
||||
}
|
||||
|
||||
content_formats = gdk_content_provider_ref_formats (priv->drag->content);
|
||||
g_object_get (priv->drag, "content", &content, NULL);
|
||||
content_formats = gdk_content_provider_ref_formats (content);
|
||||
g_object_unref (content);
|
||||
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
||||
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
||||
|
||||
@@ -122,7 +125,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
|
||||
stream = gdk_pipe_io_stream_new ();
|
||||
output_stream = g_io_stream_get_output_stream (stream);
|
||||
gdk_drag_context_write_async (priv->drag,
|
||||
gdk_drag_write_async (priv->drag,
|
||||
mime_type,
|
||||
output_stream,
|
||||
io_priority,
|
||||
@@ -321,7 +324,7 @@ gdk_drop_class_init (GdkDropClass *klass)
|
||||
g_param_spec_object ("drag",
|
||||
"Drag",
|
||||
"The drag that initiated this drop",
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GDK_TYPE_DRAG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
@@ -492,7 +495,7 @@ gdk_drop_set_actions (GdkDrop *self,
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the corresponding #GdkDrag
|
||||
**/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gdk_drop_get_drag (GdkDrop *self)
|
||||
{
|
||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||
@@ -724,8 +727,16 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
if (priv->drag)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GdkContentProvider *content;
|
||||
gboolean res;
|
||||
|
||||
if (gdk_content_provider_get_value (priv->drag->content, value, &error))
|
||||
g_object_get (priv->drag, "content", &content, NULL);
|
||||
|
||||
res = gdk_content_provider_get_value (content, value, &error);
|
||||
|
||||
g_object_unref (content);
|
||||
|
||||
if (res)
|
||||
{
|
||||
g_task_return_pointer (task, value, NULL);
|
||||
g_object_unref (task);
|
||||
|
||||
+3
-3
@@ -50,7 +50,7 @@ GdkContentFormats * gdk_drop_get_formats (GdkDrop
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drop_get_actions (GdkDrop *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDragContext * gdk_drop_get_drag (GdkDrop *self);
|
||||
GdkDrag * gdk_drop_get_drag (GdkDrop *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drop_status (GdkDrop *self,
|
||||
@@ -83,12 +83,12 @@ const GValue * gdk_drop_read_value_finish (GdkDrop
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drop_read_text_async (GdkDrop *drop,
|
||||
void gdk_drop_read_text_async (GdkDrop *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
char * gdk_drop_read_text_finish (GdkDrop *drop,
|
||||
char * gdk_drop_read_text_finish (GdkDrop *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
|
||||
+5
-18
@@ -28,7 +28,7 @@
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdropprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
@@ -165,7 +165,10 @@ gdk_event_class_init (GdkEventClass *klass)
|
||||
void
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
if (gdk_drag_context_handle_source_event (event))
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return;
|
||||
|
||||
if (gdk_surface_handle_event (event))
|
||||
return;
|
||||
|
||||
if (_gdk_event_func)
|
||||
@@ -646,11 +649,6 @@ gdk_event_copy (const GdkEvent *event)
|
||||
g_object_ref (event->dnd.drop);
|
||||
break;
|
||||
|
||||
case GDK_EXPOSE:
|
||||
if (event->expose.region)
|
||||
new_event->expose.region = cairo_region_copy (event->expose.region);
|
||||
break;
|
||||
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
if (event->button.axes)
|
||||
@@ -730,11 +728,6 @@ gdk_event_finalize (GObject *object)
|
||||
g_free (event->touch.axes);
|
||||
break;
|
||||
|
||||
case GDK_EXPOSE:
|
||||
if (event->expose.region)
|
||||
cairo_region_destroy (event->expose.region);
|
||||
break;
|
||||
|
||||
case GDK_MOTION_NOTIFY:
|
||||
g_clear_object (&event->motion.tool);
|
||||
g_free (event->motion.axes);
|
||||
@@ -832,9 +825,6 @@ gdk_event_get_time (const GdkEvent *event)
|
||||
case GDK_NOTHING:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
case GDK_EXPOSE:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
case GDK_GRAB_BROKEN:
|
||||
case GDK_EVENT_LAST:
|
||||
default:
|
||||
@@ -908,9 +898,6 @@ gdk_event_get_state (const GdkEvent *event,
|
||||
case GDK_NOTHING:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
case GDK_EXPOSE:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
case GDK_GRAB_BROKEN:
|
||||
case GDK_PAD_BUTTON_PRESS:
|
||||
case GDK_PAD_BUTTON_RELEASE:
|
||||
|
||||
+1
-9
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
|
||||
@@ -104,7 +104,6 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct _GdkEventAny GdkEventAny;
|
||||
typedef struct _GdkEventExpose GdkEventExpose;
|
||||
typedef struct _GdkEventMotion GdkEventMotion;
|
||||
typedef struct _GdkEventButton GdkEventButton;
|
||||
typedef struct _GdkEventTouch GdkEventTouch;
|
||||
@@ -145,8 +144,6 @@ typedef void (*GdkEventFunc) (GdkEvent *event,
|
||||
* hidden or destroyed, usually when the user clicks on a special icon in the
|
||||
* title bar.
|
||||
* @GDK_DESTROY: the surface has been destroyed.
|
||||
* @GDK_EXPOSE: all or part of the surface has become visible and needs to be
|
||||
* redrawn.
|
||||
* @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
|
||||
* @GDK_BUTTON_PRESS: a mouse button has been pressed.
|
||||
* @GDK_BUTTON_RELEASE: a mouse button has been released.
|
||||
@@ -157,8 +154,6 @@ typedef void (*GdkEventFunc) (GdkEvent *event,
|
||||
* @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface.
|
||||
* @GDK_CONFIGURE: the size, position or stacking order of the surface has changed.
|
||||
* Note that GTK+ discards these events for %GDK_SURFACE_CHILD surfaces.
|
||||
* @GDK_MAP: the surface has been mapped.
|
||||
* @GDK_UNMAP: the surface has been unmapped.
|
||||
* @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
|
||||
* surface (e.g. a touchscreen or graphics tablet).
|
||||
* @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
|
||||
@@ -206,7 +201,6 @@ typedef enum
|
||||
GDK_NOTHING,
|
||||
GDK_DELETE,
|
||||
GDK_DESTROY,
|
||||
GDK_EXPOSE,
|
||||
GDK_MOTION_NOTIFY,
|
||||
GDK_BUTTON_PRESS,
|
||||
GDK_BUTTON_RELEASE,
|
||||
@@ -216,8 +210,6 @@ typedef enum
|
||||
GDK_LEAVE_NOTIFY,
|
||||
GDK_FOCUS_CHANGE,
|
||||
GDK_CONFIGURE,
|
||||
GDK_MAP,
|
||||
GDK_UNMAP,
|
||||
GDK_PROXIMITY_IN,
|
||||
GDK_PROXIMITY_OUT,
|
||||
GDK_DRAG_ENTER,
|
||||
|
||||
+1
-20
@@ -26,7 +26,7 @@
|
||||
#define __GDK_EVENTS_PRIVATE_H__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
|
||||
@@ -63,23 +63,6 @@ struct _GdkEventAny
|
||||
GdkDisplay *display;
|
||||
};
|
||||
|
||||
/*
|
||||
* GdkEventExpose:
|
||||
* @type: the type of the event (%GDK_EXPOSE)
|
||||
* @surface: the surface which received the event.
|
||||
* @send_event: %TRUE if the event was sent explicitly.
|
||||
* @area: bounding box of @region.
|
||||
* @region: the region that needs to be redrawn.
|
||||
*
|
||||
* Generated when all or part of a surface becomes visible and needs to be
|
||||
* redrawn.
|
||||
*/
|
||||
struct _GdkEventExpose
|
||||
{
|
||||
GdkEventAny any;
|
||||
cairo_region_t *region;
|
||||
};
|
||||
|
||||
/*
|
||||
* GdkEventMotion:
|
||||
* @type: the type of the event.
|
||||
@@ -593,7 +576,6 @@ struct _GdkEventPadGroupMode {
|
||||
* GdkEvent:
|
||||
* @type: the #GdkEventType
|
||||
* @any: a #GdkEventAny
|
||||
* @expose: a #GdkEventExpose
|
||||
* @motion: a #GdkEventMotion
|
||||
* @button: a #GdkEventButton
|
||||
* @touch: a #GdkEventTouch
|
||||
@@ -645,7 +627,6 @@ struct _GdkEventPadGroupMode {
|
||||
union _GdkEvent
|
||||
{
|
||||
GdkEventAny any;
|
||||
GdkEventExpose expose;
|
||||
GdkEventMotion motion;
|
||||
GdkEventButton button;
|
||||
GdkEventTouch touch;
|
||||
|
||||
+3
-1
@@ -32,7 +32,7 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -291,6 +291,8 @@ GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
|
||||
void gdk_surface_get_unscaled_size (GdkSurface *surface,
|
||||
int *unscaled_width,
|
||||
int *unscaled_height);
|
||||
gboolean gdk_surface_handle_event (GdkEvent *event);
|
||||
|
||||
|
||||
/*****************************************
|
||||
* Interfaces provided by windowing code *
|
||||
|
||||
+2
-2
@@ -643,8 +643,8 @@ gdk_paintable_new_empty (int intrinsic_width,
|
||||
{
|
||||
GdkEmptyPaintable *result;
|
||||
|
||||
g_return_val_if_fail (intrinsic_width < 0, NULL);
|
||||
g_return_val_if_fail (intrinsic_height < 0, NULL);
|
||||
g_return_val_if_fail (intrinsic_width >= 0, NULL);
|
||||
g_return_val_if_fail (intrinsic_height >= 0, NULL);
|
||||
|
||||
result = g_object_new (GDK_TYPE_EMPTY_PAINTABLE, NULL);
|
||||
|
||||
|
||||
+73
-79
@@ -97,6 +97,8 @@
|
||||
|
||||
enum {
|
||||
MOVED_TO_RECT,
|
||||
SIZE_CHANGED,
|
||||
RENDER,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -105,6 +107,7 @@ enum {
|
||||
PROP_CURSOR,
|
||||
PROP_DISPLAY,
|
||||
PROP_STATE,
|
||||
PROP_MAPPED,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@@ -271,6 +274,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
GDK_TYPE_SURFACE_STATE, GDK_SURFACE_STATE_WITHDRAWN,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_MAPPED] =
|
||||
g_param_spec_boolean ("mapped",
|
||||
P_("Mapped"),
|
||||
P_("Mapped"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, properties);
|
||||
|
||||
/**
|
||||
@@ -310,6 +320,31 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
G_TYPE_POINTER,
|
||||
G_TYPE_BOOLEAN,
|
||||
G_TYPE_BOOLEAN);
|
||||
|
||||
signals[SIZE_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("size-changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
|
||||
signals[RENDER] =
|
||||
g_signal_new (g_intern_static_string ("render"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
g_signal_accumulator_true_handled,
|
||||
NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
CAIRO_GOBJECT_TYPE_REGION);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -416,6 +451,10 @@ gdk_surface_get_property (GObject *object,
|
||||
g_value_set_flags (value, surface->state);
|
||||
break;
|
||||
|
||||
case PROP_MAPPED:
|
||||
g_value_set_boolean (value, GDK_SURFACE_IS_MAPPED (surface));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -946,6 +985,7 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
|
||||
surface_remove_from_pointer_info (surface, display);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1617,20 +1657,13 @@ static void
|
||||
gdk_surface_process_updates_recurse (GdkSurface *surface,
|
||||
cairo_region_t *expose_region)
|
||||
{
|
||||
GdkEvent *event;
|
||||
gboolean handled;
|
||||
|
||||
if (surface->destroyed)
|
||||
return;
|
||||
|
||||
/* Paint the surface before the children, clipped to the surface region */
|
||||
|
||||
event = gdk_event_new (GDK_EXPOSE);
|
||||
event->any.surface = g_object_ref (surface);
|
||||
event->any.send_event = FALSE;
|
||||
event->expose.region = cairo_region_reference (expose_region);
|
||||
|
||||
_gdk_event_emit (event);
|
||||
g_object_unref (event);
|
||||
g_signal_emit (surface, signals[RENDER], 0, expose_region, &handled);
|
||||
}
|
||||
|
||||
/* Process and remove any invalid area on the native surface by creating
|
||||
@@ -2250,6 +2283,7 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
|
||||
{
|
||||
surface->state = 0;
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
}
|
||||
|
||||
did_show = _gdk_surface_update_viewable (surface);
|
||||
@@ -2265,14 +2299,6 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
|
||||
impl_class->show (surface, !did_show ? was_mapped : TRUE);
|
||||
}
|
||||
|
||||
if (!was_mapped && !gdk_surface_has_impl (surface))
|
||||
{
|
||||
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
|
||||
|
||||
if (surface->parent)
|
||||
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
|
||||
}
|
||||
|
||||
if (!was_mapped || did_raise)
|
||||
{
|
||||
recompute_visible_regions (surface, FALSE);
|
||||
@@ -2308,7 +2334,7 @@ gdk_surface_show_unraised (GdkSurface *surface)
|
||||
* other surfaces with the same parent surface appear below @surface.
|
||||
* This is true whether or not the surfaces are visible.
|
||||
*
|
||||
* If @surface is a toplevel, the surface manager may choose to deny the
|
||||
* If @surface is a toplevel, the window manager may choose to deny the
|
||||
* request to move the surface in the Z-order, gdk_surface_raise() only
|
||||
* requests the restack, does not guarantee it.
|
||||
*/
|
||||
@@ -2529,6 +2555,7 @@ gdk_surface_hide (GdkSurface *surface)
|
||||
{
|
||||
surface->state = GDK_SURFACE_STATE_WITHDRAWN;
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
}
|
||||
|
||||
if (was_mapped)
|
||||
@@ -2575,62 +2602,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
recompute_visible_regions (surface, FALSE);
|
||||
|
||||
if (was_mapped && !gdk_surface_has_impl (surface))
|
||||
{
|
||||
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
|
||||
|
||||
if (surface->parent)
|
||||
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
|
||||
}
|
||||
|
||||
/* Invalidate the rect */
|
||||
if (was_mapped)
|
||||
gdk_surface_invalidate_in_parent (surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_withdraw:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
*
|
||||
* Withdraws a surface (unmaps it and asks the surface manager to forget about it).
|
||||
* This function is not really useful as gdk_surface_hide() automatically
|
||||
* withdraws toplevel surfaces before hiding them.
|
||||
**/
|
||||
void
|
||||
gdk_surface_withdraw (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplClass *impl_class;
|
||||
gboolean was_mapped;
|
||||
GdkGLContext *current_context;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
if (surface->destroyed)
|
||||
return;
|
||||
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||
|
||||
if (gdk_surface_has_impl (surface))
|
||||
{
|
||||
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
|
||||
impl_class->withdraw (surface);
|
||||
|
||||
if (was_mapped)
|
||||
{
|
||||
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
|
||||
|
||||
if (surface->parent)
|
||||
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
|
||||
}
|
||||
|
||||
current_context = gdk_gl_context_get_current ();
|
||||
if (current_context != NULL && gdk_gl_context_get_surface (current_context) == surface)
|
||||
gdk_gl_context_clear_current ();
|
||||
|
||||
recompute_visible_regions (surface, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_move_resize_toplevel (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
@@ -2917,7 +2893,7 @@ gdk_surface_get_cursor (GdkSurface *surface)
|
||||
*
|
||||
* Note that @cursor must be for the same display as @surface.
|
||||
*
|
||||
* Use gdk_cursor_new_for_display() or gdk_cursor_new_from_texture() to
|
||||
* Use gdk_cursor_new_from_name() or gdk_cursor_new_from_texture() to
|
||||
* create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
|
||||
* Passing %NULL for the @cursor argument to gdk_surface_set_cursor() means
|
||||
* that @surface will use the cursor of its parent surface. Most surfaces
|
||||
@@ -3004,7 +2980,7 @@ gdk_surface_get_device_cursor (GdkSurface *surface,
|
||||
* @cursor: a #GdkCursor
|
||||
*
|
||||
* Sets a specific #GdkCursor for a given device when it gets inside @surface.
|
||||
* Use gdk_cursor_new_for_display() or gdk_cursor_new_from_texture() to create
|
||||
* Use gdk_cursor_new_fromm_name() or gdk_cursor_new_from_texture() to create
|
||||
* the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. Passing
|
||||
* %NULL for the @cursor argument to gdk_surface_set_cursor() means that
|
||||
* @surface will use the cursor of its parent surface. Most surfaces should
|
||||
@@ -3445,7 +3421,7 @@ gdk_surface_merge_child_input_shapes (GdkSurface *surface)
|
||||
* gdk_surface_get_modal_hint:
|
||||
* @surface: A toplevel #GdkSurface.
|
||||
*
|
||||
* Determines whether or not the surface manager is hinted that @surface
|
||||
* Determines whether or not the window manager is hinted that @surface
|
||||
* has modal behaviour.
|
||||
*
|
||||
* Returns: whether or not the surface has the modal hint set.
|
||||
@@ -3909,11 +3885,8 @@ _gdk_make_event (GdkSurface *surface,
|
||||
|
||||
case GDK_FOCUS_CHANGE:
|
||||
case GDK_CONFIGURE:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
case GDK_EXPOSE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -4427,7 +4400,7 @@ gdk_surface_set_transient_for (GdkSurface *surface,
|
||||
* @x: (out): return location for X position of surface frame
|
||||
* @y: (out): return location for Y position of surface frame
|
||||
*
|
||||
* Obtains the top-left corner of the surface manager frame in root
|
||||
* Obtains the top-left corner of the window manager frame in root
|
||||
* surface coordinates.
|
||||
*
|
||||
**/
|
||||
@@ -5140,10 +5113,10 @@ gdk_surface_register_dnd (GdkSurface *surface)
|
||||
*
|
||||
* This function is called by the drag source.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): a newly created #GdkDragContext or
|
||||
* Returns: (transfer full) (nullable): a newly created #GdkDrag or
|
||||
* %NULL on error.
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
@@ -5467,6 +5440,7 @@ void
|
||||
gdk_surface_set_state (GdkSurface *surface,
|
||||
GdkSurfaceState new_state)
|
||||
{
|
||||
gboolean was_mapped, mapped;
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
if (new_state == surface->state)
|
||||
@@ -5477,8 +5451,12 @@ gdk_surface_set_state (GdkSurface *surface,
|
||||
* inconsistent state to the user.
|
||||
*/
|
||||
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||
|
||||
surface->state = new_state;
|
||||
|
||||
mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||
|
||||
_gdk_surface_update_viewable (surface);
|
||||
|
||||
/* We only really send the event to toplevels, since
|
||||
@@ -5490,12 +5468,15 @@ gdk_surface_set_state (GdkSurface *surface,
|
||||
{
|
||||
case GDK_SURFACE_TOPLEVEL:
|
||||
case GDK_SURFACE_TEMP: /* ? */
|
||||
g_object_notify (G_OBJECT (surface), "state");
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
|
||||
break;
|
||||
case GDK_SURFACE_CHILD:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (was_mapped != mapped)
|
||||
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -5505,3 +5486,16 @@ gdk_synthesize_surface_state (GdkSurface *surface,
|
||||
{
|
||||
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_surface_handle_event (GdkEvent *event)
|
||||
{
|
||||
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
|
||||
{
|
||||
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
|
||||
event->configure.width, event->configure.height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -460,8 +460,6 @@ void gdk_surface_show (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_hide (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_withdraw (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_show_unraised (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_move (GdkSurface *surface,
|
||||
|
||||
@@ -193,7 +193,7 @@ struct _GdkSurfaceImplClass
|
||||
gdouble opacity);
|
||||
void (* destroy_notify) (GdkSurface *surface);
|
||||
void (* register_dnd) (GdkSurface *surface);
|
||||
GdkDragContext * (*drag_begin) (GdkSurface *surface,
|
||||
GdkDrag * (*drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider*content,
|
||||
GdkDragAction actions,
|
||||
|
||||
+2
-2
@@ -123,7 +123,7 @@ typedef struct _GdkContentProvider GdkContentProvider;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkTexture GdkTexture;
|
||||
typedef struct _GdkDevice GdkDevice;
|
||||
typedef struct _GdkDragContext GdkDragContext;
|
||||
typedef struct _GdkDrag GdkDrag;
|
||||
typedef struct _GdkDrop GdkDrop;
|
||||
|
||||
typedef struct _GdkClipboard GdkClipboard;
|
||||
@@ -571,7 +571,7 @@ typedef enum
|
||||
* useful if source and destination agree on what it means.
|
||||
* @GDK_ACTION_ASK: Ask the user what to do with the data.
|
||||
*
|
||||
* Used in #GdkDragContext to indicate what the destination
|
||||
* Used in #GdkDrag to indicate what the destination
|
||||
* should do with the dropped data.
|
||||
*/
|
||||
typedef enum
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ gdk_public_sources = files([
|
||||
'gdkdevicetool.c',
|
||||
'gdkdisplay.c',
|
||||
'gdkdisplaymanager.c',
|
||||
'gdkdnd.c',
|
||||
'gdkdrag.c',
|
||||
'gdkdrawcontext.c',
|
||||
'gdkdrop.c',
|
||||
'gdkevents.c',
|
||||
@@ -65,7 +65,7 @@ gdk_public_headers = files([
|
||||
'gdkdevicetool.h',
|
||||
'gdkdisplay.h',
|
||||
'gdkdisplaymanager.h',
|
||||
'gdkdnd.h',
|
||||
'gdkdrag.h',
|
||||
'gdkdrawcontext.h',
|
||||
'gdkdrop.h',
|
||||
'gdkevents.h',
|
||||
|
||||
@@ -52,13 +52,13 @@ static void
|
||||
gdk_wayland_clipboard_discard_offer (GdkWaylandClipboard *cb)
|
||||
{
|
||||
g_clear_pointer (&cb->offer_formats, gdk_content_formats_unref);
|
||||
g_clear_pointer (&cb->offer, (GDestroyNotify) wl_data_offer_destroy);
|
||||
g_clear_pointer (&cb->offer, wl_data_offer_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_clipboard_discard_source (GdkWaylandClipboard *cb)
|
||||
{
|
||||
g_clear_pointer (&cb->source, (GDestroyNotify) wl_data_source_destroy);
|
||||
g_clear_pointer (&cb->source, wl_data_source_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -247,12 +247,9 @@ struct _GdkWaylandSeat
|
||||
GdkClipboard *clipboard;
|
||||
GdkClipboard *primary_clipboard;
|
||||
struct wl_data_device *data_device;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkDrop *drop;
|
||||
|
||||
/* Source/dest for non-local dnd */
|
||||
GdkSurface *foreign_dnd_surface;
|
||||
|
||||
/* Some tracking on gesture events */
|
||||
guint gesture_n_fingers;
|
||||
gdouble gesture_scale;
|
||||
@@ -1090,7 +1087,7 @@ gdk_wayland_seat_discard_pending_offer (GdkWaylandSeat *seat)
|
||||
gdk_content_formats_unref (ignore);
|
||||
seat->pending_builder = NULL;
|
||||
}
|
||||
g_clear_pointer (&seat->pending_offer, (GDestroyNotify) wl_data_offer_destroy);
|
||||
g_clear_pointer (&seat->pending_offer, wl_data_offer_destroy);
|
||||
seat->pending_source_actions = 0;
|
||||
seat->pending_action = 0;
|
||||
}
|
||||
@@ -4516,6 +4513,12 @@ pointer_surface_update_scale (GdkDevice *device)
|
||||
gdk_wayland_device_update_surface_cursor (device);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat)
|
||||
{
|
||||
pointer_surface_update_scale (seat->master_pointer);
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_surface_enter (void *data,
|
||||
struct wl_surface *wl_surface,
|
||||
@@ -4556,12 +4559,6 @@ static const struct wl_surface_listener pointer_surface_listener = {
|
||||
pointer_surface_leave
|
||||
};
|
||||
|
||||
static GdkSurface *
|
||||
create_foreign_dnd_surface (GdkDisplay *display)
|
||||
{
|
||||
return gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 1, 1 });
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer)
|
||||
{
|
||||
@@ -4596,7 +4593,6 @@ gdk_wayland_seat_finalize (GObject *object)
|
||||
g_clear_object (&seat->clipboard);
|
||||
g_clear_object (&seat->primary_clipboard);
|
||||
g_hash_table_destroy (seat->touches);
|
||||
gdk_surface_destroy (seat->foreign_dnd_surface);
|
||||
zwp_tablet_seat_v2_destroy (seat->wp_tablet_seat);
|
||||
stop_key_repeat (seat);
|
||||
|
||||
@@ -4938,7 +4934,6 @@ _gdk_wayland_display_create_seat (GdkWaylandDisplay *display_wayland,
|
||||
seat->keymap = _gdk_wayland_keymap_new (display);
|
||||
seat->display = display;
|
||||
seat->touches = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free);
|
||||
seat->foreign_dnd_surface = create_foreign_dnd_surface (display);
|
||||
seat->wl_seat = wl_seat;
|
||||
|
||||
wl_seat_add_listener (seat->wl_seat, &seat_listener, seat);
|
||||
@@ -5133,12 +5128,12 @@ gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDragContext *context)
|
||||
gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDrag *drag)
|
||||
{
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
|
||||
g_set_object (&wayland_seat->drag, context);
|
||||
g_set_object (&wayland_seat->drag, drag);
|
||||
}
|
||||
|
||||
struct wl_data_device *
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkmonitor-wayland.h"
|
||||
#include "gdkseat-wayland.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
@@ -1883,9 +1884,20 @@ transform_to_string (int transform)
|
||||
static void
|
||||
update_scale (GdkDisplay *display)
|
||||
{
|
||||
GList *seats;
|
||||
GList *l;
|
||||
|
||||
g_list_foreach (gdk_wayland_display_get_toplevel_surfaces (display),
|
||||
(GFunc)gdk_wayland_surface_update_scale,
|
||||
NULL);
|
||||
seats = gdk_display_list_seats (display);
|
||||
for (l = seats; l; l = l->next)
|
||||
{
|
||||
GdkSeat *seat = l->data;
|
||||
|
||||
gdk_wayland_seat_update_cursor_scale (GDK_WAYLAND_SEAT (seat));
|
||||
}
|
||||
g_list_free (seats);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1,440 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdndprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkprivate-wayland.h"
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkseat-wayland.h"
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
#include <glib-unix.h>
|
||||
#include <gio/gunixinputstream.h>
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <string.h>
|
||||
|
||||
#define GDK_TYPE_WAYLAND_DRAG_CONTEXT (gdk_wayland_drag_context_get_type ())
|
||||
#define GDK_WAYLAND_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContext))
|
||||
#define GDK_WAYLAND_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
|
||||
#define GDK_IS_WAYLAND_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
|
||||
#define GDK_IS_WAYLAND_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG_CONTEXT))
|
||||
#define GDK_WAYLAND_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG_CONTEXT, GdkWaylandDragContextClass))
|
||||
|
||||
typedef struct _GdkWaylandDragContext GdkWaylandDragContext;
|
||||
typedef struct _GdkWaylandDragContextClass GdkWaylandDragContextClass;
|
||||
|
||||
struct _GdkWaylandDragContext
|
||||
{
|
||||
GdkDragContext context;
|
||||
GdkSurface *dnd_surface;
|
||||
struct wl_surface *dnd_wl_surface;
|
||||
struct wl_data_source *data_source;
|
||||
struct wl_data_offer *offer;
|
||||
GdkDragAction selected_action;
|
||||
uint32_t serial;
|
||||
gint hot_x;
|
||||
gint hot_y;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDragContextClass
|
||||
{
|
||||
GdkDragContextClass parent_class;
|
||||
};
|
||||
|
||||
static GList *contexts;
|
||||
|
||||
GType gdk_wayland_drag_context_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandDragContext, gdk_wayland_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_finalize (GObject *object)
|
||||
{
|
||||
GdkWaylandDragContext *wayland_context = GDK_WAYLAND_DRAG_CONTEXT (object);
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
GdkSurface *dnd_surface;
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
|
||||
gdk_drag_context_set_cursor (context, NULL);
|
||||
|
||||
g_clear_pointer (&wayland_context->data_source, (GDestroyNotify) wl_data_source_destroy);
|
||||
g_clear_pointer (&wayland_context->offer, (GDestroyNotify) wl_data_offer_destroy);
|
||||
|
||||
dnd_surface = wayland_context->dnd_surface;
|
||||
|
||||
G_OBJECT_CLASS (gdk_wayland_drag_context_parent_class)->finalize (object);
|
||||
|
||||
if (dnd_surface)
|
||||
gdk_surface_destroy (dnd_surface);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
gdk_to_wl_actions (GdkDragAction action)
|
||||
{
|
||||
uint32_t dnd_actions = 0;
|
||||
|
||||
if (action & (GDK_ACTION_COPY | GDK_ACTION_LINK))
|
||||
dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||
if (action & GDK_ACTION_MOVE)
|
||||
dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
|
||||
if (action & GDK_ACTION_ASK)
|
||||
dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
|
||||
|
||||
return dnd_actions;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drag_abort (GdkDragContext *context,
|
||||
guint32 time)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drag_drop (GdkDragContext *context,
|
||||
guint32 time)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_init (GdkWaylandDragContext *context_wayland)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
|
||||
context = GDK_DRAG_CONTEXT (context_wayland);
|
||||
contexts = g_list_prepend (contexts, context);
|
||||
|
||||
context->action = GDK_ACTION_COPY;
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
gdk_wayland_drag_context_get_drag_surface (GdkDragContext *context)
|
||||
{
|
||||
return GDK_WAYLAND_DRAG_CONTEXT (context)->dnd_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
gint prev_hot_x = context_wayland->hot_x;
|
||||
gint prev_hot_y = context_wayland->hot_y;
|
||||
const GdkRectangle damage_rect = { .width = 1, .height = 1 };
|
||||
|
||||
context_wayland->hot_x = hot_x;
|
||||
context_wayland->hot_y = hot_y;
|
||||
|
||||
if (prev_hot_x == hot_x && prev_hot_y == hot_y)
|
||||
return;
|
||||
|
||||
_gdk_wayland_surface_offset_next_wl_buffer (context_wayland->dnd_surface,
|
||||
-hot_x, -hot_y);
|
||||
gdk_surface_invalidate_rect (context_wayland->dnd_surface, &damage_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_set_cursor (GdkDragContext *context,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkDevice *device = gdk_drag_context_get_device (context);
|
||||
|
||||
gdk_wayland_seat_set_global_cursor (gdk_device_get_seat (device), cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_action_changed (GdkDragContext *context,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_drag_get_cursor (context, action);
|
||||
gdk_drag_context_set_cursor (context, cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drop_performed (GdkDragContext *context,
|
||||
guint32 time_)
|
||||
{
|
||||
gdk_drag_context_set_cursor (context, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_cancel (GdkDragContext *context,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
gdk_drag_context_set_cursor (context, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_drop_done (GdkDragContext *context,
|
||||
gboolean success)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkDevice *device = gdk_drag_context_get_device (context);
|
||||
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), context);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (context_wayland->dnd_surface)
|
||||
gdk_surface_hide (context_wayland->dnd_surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_wayland_drag_context_finalize;
|
||||
|
||||
context_class->drag_abort = gdk_wayland_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_wayland_drag_context_drag_drop;
|
||||
context_class->get_drag_surface = gdk_wayland_drag_context_get_drag_surface;
|
||||
context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
|
||||
context_class->drop_done = gdk_wayland_drag_context_drop_done;
|
||||
context_class->set_cursor = gdk_wayland_drag_context_set_cursor;
|
||||
context_class->action_changed = gdk_wayland_drag_context_action_changed;
|
||||
context_class->drop_performed = gdk_wayland_drag_context_drop_performed;
|
||||
context_class->cancel = gdk_wayland_drag_context_cancel;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_surface_register_dnd (GdkSurface *surface)
|
||||
{
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
create_dnd_surface (GdkDisplay *display)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 });
|
||||
|
||||
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static inline GdkDragAction
|
||||
_wl_to_gdk_actions (uint32_t dnd_actions)
|
||||
{
|
||||
GdkDragAction actions = 0;
|
||||
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
|
||||
actions |= GDK_ACTION_COPY;
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
|
||||
actions |= GDK_ACTION_MOVE;
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
|
||||
actions |= GDK_ACTION_ASK;
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_target (void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type)
|
||||
{
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("data source target, source = %p, mime_type = %s",
|
||||
source, mime_type));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_write_done (GObject *context,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (context), result, &error))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (GDK_DRAG_CONTEXT (context)), DND, g_message ("%p: failed to write stream: %s", context, error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_send (void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type,
|
||||
int32_t fd)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
GOutputStream *stream;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), DND, g_message ("%p: data source send request for %s on fd %d\n",
|
||||
source, mime_type, fd));
|
||||
|
||||
//mime_type = gdk_intern_mime_type (mime_type);
|
||||
mime_type = g_intern_string (mime_type);
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
|
||||
gdk_drag_context_write_async (context,
|
||||
mime_type,
|
||||
stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_wayland_drag_context_write_done,
|
||||
context);
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_cancelled (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
|
||||
g_message ("data source cancelled, source = %p", source));
|
||||
|
||||
gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_dnd_drop_performed (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
|
||||
g_signal_emit_by_name (context, "drop-performed");
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_dnd_finished (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
|
||||
g_signal_emit_by_name (context, "dnd-finished");
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_action (void *data,
|
||||
struct wl_data_source *source,
|
||||
uint32_t action)
|
||||
{
|
||||
GdkDragContext *context = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_context_get_display (context), EVENTS,
|
||||
g_message ("data source action, source = %p action=%x",
|
||||
source, action));
|
||||
|
||||
context->action = _wl_to_gdk_actions (action);
|
||||
g_signal_emit_by_name (context, "action-changed", context->action);
|
||||
}
|
||||
|
||||
static const struct wl_data_source_listener data_source_listener = {
|
||||
data_source_target,
|
||||
data_source_send,
|
||||
data_source_cancelled,
|
||||
data_source_dnd_drop_performed,
|
||||
data_source_dnd_finished,
|
||||
data_source_action,
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_context_create_data_source (GdkDragContext *context)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
|
||||
GdkDisplay *display = gdk_drag_context_get_display (context);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
const char *const *mimetypes;
|
||||
gsize i, n_mimetypes;
|
||||
|
||||
context_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
|
||||
wl_data_source_add_listener (context_wayland->data_source,
|
||||
&data_source_listener,
|
||||
context);
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (context), &n_mimetypes);
|
||||
for (i = 0; i < n_mimetypes; i++)
|
||||
{
|
||||
wl_data_source_offer (context_wayland->data_source, mimetypes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GdkDragContext *
|
||||
_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkWaylandDragContext *context_wayland;
|
||||
GdkDragContext *context;
|
||||
GdkSeat *seat;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
|
||||
seat = gdk_device_get_seat (device);
|
||||
|
||||
context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
context = GDK_DRAG_CONTEXT (context_wayland);
|
||||
context->source_surface = g_object_ref (surface);
|
||||
|
||||
context_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
|
||||
context_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (context_wayland->dnd_surface);
|
||||
|
||||
gdk_wayland_drag_context_create_data_source (context);
|
||||
|
||||
if (display_wayland->data_device_manager_version >=
|
||||
WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
|
||||
{
|
||||
wl_data_source_set_actions (context_wayland->data_source,
|
||||
gdk_to_wl_actions (actions));
|
||||
}
|
||||
|
||||
gdk_wayland_seat_set_drag (seat, context);
|
||||
|
||||
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
|
||||
context_wayland->data_source,
|
||||
gdk_wayland_surface_get_wl_surface (surface),
|
||||
context_wayland->dnd_wl_surface,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
if (context->source_surface)
|
||||
g_object_unref (context->source_surface);
|
||||
|
||||
context->source_surface = surface ? g_object_ref (surface) : NULL;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkprivate-wayland.h"
|
||||
#include "gdkcontentformats.h"
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkseat-wayland.h"
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
#include <glib-unix.h>
|
||||
#include <gio/gunixinputstream.h>
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <string.h>
|
||||
|
||||
#define GDK_TYPE_WAYLAND_DRAG (gdk_wayland_drag_get_type ())
|
||||
#define GDK_WAYLAND_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDrag))
|
||||
#define GDK_WAYLAND_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDragClass))
|
||||
#define GDK_IS_WAYLAND_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG))
|
||||
#define GDK_IS_WAYLAND_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DRAG))
|
||||
#define GDK_WAYLAND_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DRAG, GdkWaylandDragClass))
|
||||
|
||||
typedef struct _GdkWaylandDrag GdkWaylandDrag;
|
||||
typedef struct _GdkWaylandDragClass GdkWaylandDragClass;
|
||||
|
||||
struct _GdkWaylandDrag
|
||||
{
|
||||
GdkDrag drag;
|
||||
GdkSurface *dnd_surface;
|
||||
struct wl_surface *dnd_wl_surface;
|
||||
struct wl_data_source *data_source;
|
||||
struct wl_data_offer *offer;
|
||||
uint32_t serial;
|
||||
gint hot_x;
|
||||
gint hot_y;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDragClass
|
||||
{
|
||||
GdkDragClass parent_class;
|
||||
};
|
||||
|
||||
static GList *drags;
|
||||
|
||||
GType gdk_wayland_drag_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandDrag, gdk_wayland_drag, GDK_TYPE_DRAG)
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkWaylandDrag *wayland_drag = GDK_WAYLAND_DRAG (object);
|
||||
GdkDrag *drag = GDK_DRAG (object);
|
||||
GdkSurface *dnd_surface;
|
||||
|
||||
drags = g_list_remove (drags, drag);
|
||||
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
|
||||
g_clear_pointer (&wayland_drag->data_source, wl_data_source_destroy);
|
||||
g_clear_pointer (&wayland_drag->offer, wl_data_offer_destroy);
|
||||
|
||||
dnd_surface = wayland_drag->dnd_surface;
|
||||
|
||||
G_OBJECT_CLASS (gdk_wayland_drag_parent_class)->finalize (object);
|
||||
|
||||
if (dnd_surface)
|
||||
gdk_surface_destroy (dnd_surface);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
gdk_to_wl_actions (GdkDragAction action)
|
||||
{
|
||||
uint32_t dnd_actions = 0;
|
||||
|
||||
if (action & (GDK_ACTION_COPY | GDK_ACTION_LINK))
|
||||
dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||
if (action & GDK_ACTION_MOVE)
|
||||
dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE;
|
||||
if (action & GDK_ACTION_ASK)
|
||||
dnd_actions |= WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK;
|
||||
|
||||
return dnd_actions;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_init (GdkWaylandDrag *drag_wayland)
|
||||
{
|
||||
GdkDrag *drag;
|
||||
|
||||
drag = GDK_DRAG (drag_wayland);
|
||||
drags = g_list_prepend (drags, drag);
|
||||
|
||||
gdk_drag_set_selected_action (drag, GDK_ACTION_COPY);
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
gdk_wayland_drag_get_drag_surface (GdkDrag *drag)
|
||||
{
|
||||
return GDK_WAYLAND_DRAG (drag)->dnd_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
gint prev_hot_x = drag_wayland->hot_x;
|
||||
gint prev_hot_y = drag_wayland->hot_y;
|
||||
const GdkRectangle damage_rect = { .width = 1, .height = 1 };
|
||||
|
||||
drag_wayland->hot_x = hot_x;
|
||||
drag_wayland->hot_y = hot_y;
|
||||
|
||||
if (prev_hot_x == hot_x && prev_hot_y == hot_y)
|
||||
return;
|
||||
|
||||
_gdk_wayland_surface_offset_next_wl_buffer (drag_wayland->dnd_surface,
|
||||
-hot_x, -hot_y);
|
||||
gdk_surface_invalidate_rect (drag_wayland->dnd_surface, &damage_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkDevice *device = gdk_drag_get_device (drag);
|
||||
|
||||
if (device != NULL)
|
||||
gdk_wayland_seat_set_global_cursor (gdk_device_get_seat (device), cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_drop_performed (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
GdkDevice *device = gdk_drag_get_device (drag);
|
||||
|
||||
gdk_wayland_seat_set_drag (gdk_device_get_seat (device), drag);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (drag_wayland->dnd_surface)
|
||||
gdk_surface_hide (drag_wayland->dnd_surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_class_init (GdkWaylandDragClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_wayland_drag_finalize;
|
||||
|
||||
drag_class->get_drag_surface = gdk_wayland_drag_get_drag_surface;
|
||||
drag_class->set_hotspot = gdk_wayland_drag_set_hotspot;
|
||||
drag_class->drop_done = gdk_wayland_drag_drop_done;
|
||||
drag_class->set_cursor = gdk_wayland_drag_set_cursor;
|
||||
drag_class->drop_performed = gdk_wayland_drag_drop_performed;
|
||||
drag_class->cancel = gdk_wayland_drag_cancel;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_surface_register_dnd (GdkSurface *surface)
|
||||
{
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
create_dnd_surface (GdkDisplay *display)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = gdk_surface_new_popup (display, &(GdkRectangle) { 0, 0, 100, 100 });
|
||||
|
||||
gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DND);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static inline GdkDragAction
|
||||
_wl_to_gdk_actions (uint32_t dnd_actions)
|
||||
{
|
||||
GdkDragAction actions = 0;
|
||||
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY)
|
||||
actions |= GDK_ACTION_COPY;
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE)
|
||||
actions |= GDK_ACTION_MOVE;
|
||||
if (dnd_actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK)
|
||||
actions |= GDK_ACTION_ASK;
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_target (void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type)
|
||||
{
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("data source target, source = %p, mime_type = %s",
|
||||
source, mime_type));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_write_done (GObject *drag,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (GDK_DRAG (drag)), DND, g_message ("%p: failed to write stream: %s", drag, error->message));
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_send (void *data,
|
||||
struct wl_data_source *source,
|
||||
const char *mime_type,
|
||||
int32_t fd)
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
GOutputStream *stream;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), DND, g_message ("%p: data source send request for %s on fd %d\n",
|
||||
source, mime_type, fd));
|
||||
|
||||
//mime_type = gdk_intern_mime_type (mime_type);
|
||||
mime_type = g_intern_string (mime_type);
|
||||
stream = g_unix_output_stream_new (fd, TRUE);
|
||||
|
||||
gdk_drag_write_async (drag,
|
||||
mime_type,
|
||||
stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
NULL,
|
||||
gdk_wayland_drag_write_done,
|
||||
drag);
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_cancelled (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
|
||||
g_message ("data source cancelled, source = %p", source));
|
||||
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_dnd_drop_performed (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
|
||||
g_signal_emit_by_name (drag, "drop-performed");
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_dnd_finished (void *data,
|
||||
struct wl_data_source *source)
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
}
|
||||
|
||||
static void
|
||||
data_source_action (void *data,
|
||||
struct wl_data_source *source,
|
||||
uint32_t action)
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_drag_get_display (drag), EVENTS,
|
||||
g_message ("data source action, source = %p action=%x",
|
||||
source, action));
|
||||
|
||||
gdk_drag_set_selected_action (drag, _wl_to_gdk_actions (action));
|
||||
}
|
||||
|
||||
static const struct wl_data_source_listener data_source_listener = {
|
||||
data_source_target,
|
||||
data_source_send,
|
||||
data_source_cancelled,
|
||||
data_source_dnd_drop_performed,
|
||||
data_source_dnd_finished,
|
||||
data_source_action,
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_drag_create_data_source (GdkDrag *drag)
|
||||
{
|
||||
GdkWaylandDrag *drag_wayland = GDK_WAYLAND_DRAG (drag);
|
||||
GdkDisplay *display = gdk_drag_get_display (drag);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
const char *const *mimetypes;
|
||||
gsize i, n_mimetypes;
|
||||
|
||||
drag_wayland->data_source = wl_data_device_manager_create_data_source (display_wayland->data_device_manager);
|
||||
wl_data_source_add_listener (drag_wayland->data_source,
|
||||
&data_source_listener,
|
||||
drag);
|
||||
|
||||
mimetypes = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mimetypes);
|
||||
for (i = 0; i < n_mimetypes; i++)
|
||||
{
|
||||
wl_data_source_offer (drag_wayland->data_source, mimetypes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GdkDrag *
|
||||
_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkWaylandDrag *drag_wayland;
|
||||
GdkDrag *drag;
|
||||
GdkSeat *seat;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
GdkCursor *cursor;
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
|
||||
seat = gdk_device_get_seat (device);
|
||||
|
||||
drag_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG,
|
||||
"surface", surface,
|
||||
"device", device,
|
||||
"content", content,
|
||||
"actions", actions,
|
||||
NULL);
|
||||
|
||||
drag = GDK_DRAG (drag_wayland);
|
||||
|
||||
drag_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
|
||||
drag_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (drag_wayland->dnd_surface);
|
||||
|
||||
gdk_wayland_drag_create_data_source (drag);
|
||||
|
||||
if (display_wayland->data_device_manager_version >=
|
||||
WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
|
||||
{
|
||||
wl_data_source_set_actions (drag_wayland->data_source,
|
||||
gdk_to_wl_actions (actions));
|
||||
}
|
||||
|
||||
gdk_wayland_seat_set_drag (seat, drag);
|
||||
|
||||
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
|
||||
drag_wayland->data_source,
|
||||
gdk_wayland_surface_get_wl_surface (surface),
|
||||
drag_wayland->dnd_wl_surface,
|
||||
_gdk_wayland_display_get_serial (display_wayland));
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
|
||||
gdk_drag_set_cursor (drag, cursor);
|
||||
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
return drag;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ gdk_wayland_drop_finalize (GObject *object)
|
||||
{
|
||||
GdkWaylandDrop *wayland_drop = GDK_WAYLAND_DROP (object);
|
||||
|
||||
g_clear_pointer (&wayland_drop->offer, (GDestroyNotify) wl_data_offer_destroy);
|
||||
g_clear_pointer (&wayland_drop->offer, wl_data_offer_destroy);
|
||||
|
||||
G_OBJECT_CLASS (gdk_wayland_drop_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ gdk_wayland_drop_init (GdkWaylandDrop *drop)
|
||||
|
||||
GdkDrop *
|
||||
gdk_wayland_drop_new (GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
struct wl_data_offer *offer,
|
||||
|
||||
@@ -62,20 +62,20 @@ gdk_wayland_primary_discard_pending (GdkWaylandPrimary *cb)
|
||||
gdk_content_formats_unref (ignore);
|
||||
cb->pending_builder = NULL;
|
||||
}
|
||||
g_clear_pointer (&cb->pending, (GDestroyNotify) gtk_primary_selection_offer_destroy);
|
||||
g_clear_pointer (&cb->pending, gtk_primary_selection_offer_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_primary_discard_offer (GdkWaylandPrimary *cb)
|
||||
{
|
||||
g_clear_pointer (&cb->offer_formats, gdk_content_formats_unref);
|
||||
g_clear_pointer (&cb->offer, (GDestroyNotify) gtk_primary_selection_offer_destroy);
|
||||
g_clear_pointer (&cb->offer, gtk_primary_selection_offer_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_primary_discard_source (GdkWaylandPrimary *cb)
|
||||
{
|
||||
g_clear_pointer (&cb->source, (GDestroyNotify) wl_data_source_destroy);
|
||||
g_clear_pointer (&cb->source, gtk_primary_selection_source_destroy);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -95,7 +95,7 @@ void gdk_wayland_surface_attach_image (GdkSurface
|
||||
const cairo_region_t *damage);
|
||||
|
||||
void _gdk_wayland_surface_register_dnd (GdkSurface *surface);
|
||||
GdkDragContext *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
@@ -105,7 +105,7 @@ void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
|
||||
int x,
|
||||
int y);
|
||||
GdkDrop * gdk_wayland_drop_new (GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
struct wl_data_offer *offer,
|
||||
@@ -115,13 +115,10 @@ void gdk_wayland_drop_set_source_actions (GdkDrop
|
||||
void gdk_wayland_drop_set_action (GdkDrop *drop,
|
||||
uint32_t action);
|
||||
|
||||
void _gdk_wayland_drag_context_set_source_surface (GdkDragContext *context,
|
||||
GdkSurface *surface);
|
||||
|
||||
void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent,
|
||||
GdkSurfaceAttr *attributes);
|
||||
void _gdk_wayland_display_create_surface_impl (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *real_parent,
|
||||
GdkSurfaceAttr *attributes);
|
||||
|
||||
gint _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
@@ -147,7 +144,7 @@ struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_devic
|
||||
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
|
||||
struct wl_data_source *source);
|
||||
|
||||
GdkDragContext * gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
|
||||
GdkDrag* gdk_wayland_device_get_drop_context (GdkDevice *gdk_device);
|
||||
|
||||
void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
|
||||
GdkEventSequence *sequence);
|
||||
@@ -193,7 +190,7 @@ struct gtk_surface1 * gdk_wayland_surface_get_gtk_surface (GdkSurface *surface);
|
||||
void gdk_wayland_seat_set_global_cursor (GdkSeat *seat,
|
||||
GdkCursor *cursor);
|
||||
void gdk_wayland_seat_set_drag (GdkSeat *seat,
|
||||
GdkDragContext *drag);
|
||||
GdkDrag *drag);
|
||||
|
||||
struct wl_output *gdk_wayland_surface_get_wl_output (GdkSurface *surface);
|
||||
|
||||
|
||||
@@ -41,4 +41,6 @@ struct _GdkWaylandSeatClass
|
||||
|
||||
GType gdk_wayland_seat_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat);
|
||||
|
||||
#endif /* __GDK_WAYLAND_SEAT_H__ */
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "gdkprivate-wayland.h"
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkcontentformatsprivate.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkproperty.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -2639,8 +2639,6 @@ gdk_wayland_surface_show (GdkSurface *surface,
|
||||
gdk_wayland_surface_create_surface (surface);
|
||||
|
||||
gdk_wayland_surface_map (surface);
|
||||
|
||||
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -5,7 +5,7 @@ gdk_wayland_sources = files([
|
||||
'gdkcursor-wayland.c',
|
||||
'gdkdevice-wayland.c',
|
||||
'gdkdisplay-wayland.c',
|
||||
'gdkdnd-wayland.c',
|
||||
'gdkdrag-wayland.c',
|
||||
'gdkdrop-wayland.c',
|
||||
'gdkeventsource.c',
|
||||
'gdkglcontext-wayland.c',
|
||||
|
||||
@@ -280,7 +280,7 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
|
||||
#include "gdkclipboard-win32.h"
|
||||
#include "gdkclipdrop-win32.h"
|
||||
#include "gdkhdataoutputstream-win32.h"
|
||||
#include "gdk/gdkdndprivate.h"
|
||||
#include "gdk/gdkdragprivate.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkwin32.h"
|
||||
|
||||
+183
-221
@@ -130,7 +130,7 @@
|
||||
* From that point forward the context gets any events emitted
|
||||
* by GDK, and can prevent these events from going anywhere else.
|
||||
* They are all handled in
|
||||
* S: gdk_drag_context_handle_source_event() -> backend:handle_event()
|
||||
* S: gdk_drag_handle_source_event() -> backend:handle_event()
|
||||
* (except for wayland backend - it doesn't have that function).
|
||||
*
|
||||
* That function catches the following events:
|
||||
@@ -195,14 +195,14 @@
|
||||
/* For C-style COM wrapper macros */
|
||||
#define COBJMACROS
|
||||
|
||||
#include "gdkdnd.h"
|
||||
#include "gdkdrag.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdk/gdkdndprivate.h"
|
||||
#include "gdk/gdkdragprivate.h"
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
@@ -226,12 +226,12 @@ typedef struct
|
||||
IDropSource ids;
|
||||
IDropSourceNotify idsn;
|
||||
gint ref_count;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
|
||||
/* These are thread-local
|
||||
* copies of the similar fields from GdkWin32DragContext
|
||||
* copies of the similar fields from GdkWin32Drag
|
||||
*/
|
||||
GdkWin32DragContextUtilityData util_data;
|
||||
GdkWin32DragUtilityData util_data;
|
||||
|
||||
/* Cached here, so that we don't have to look in
|
||||
* the context every time.
|
||||
@@ -249,7 +249,7 @@ typedef struct
|
||||
typedef struct {
|
||||
IDataObject ido;
|
||||
int ref_count;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GArray *formats;
|
||||
} data_object;
|
||||
|
||||
@@ -342,8 +342,8 @@ struct _GdkWin32DnDThreadUpdateDragState
|
||||
{
|
||||
GdkWin32DnDThreadQueueItem base;
|
||||
|
||||
gpointer opaque_ddd;
|
||||
GdkWin32DragContextUtilityData produced_util_data;
|
||||
gpointer opaque_ddd;
|
||||
GdkWin32DragUtilityData produced_util_data;
|
||||
};
|
||||
|
||||
typedef struct _GdkWin32DnDThread GdkWin32DnDThread;
|
||||
@@ -485,10 +485,10 @@ process_dnd_queue (gboolean timed,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drag_context_drop_response (GdkDragContext *drag,
|
||||
GdkDragAction action)
|
||||
_gdk_win32_local_drag_drop_response (GdkDrag *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_context_drop_response: 0x%p\n",
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_drop_response: 0x%p\n",
|
||||
drag));
|
||||
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
@@ -500,8 +500,8 @@ do_drag_drop_response (gpointer user_data)
|
||||
{
|
||||
GdkWin32DnDThreadDoDragDrop *ddd = (GdkWin32DnDThreadDoDragDrop *) user_data;
|
||||
HRESULT hr = ddd->received_result;
|
||||
GdkDragContext *drag = GDK_DRAG_CONTEXT (ddd->base.opaque_context);
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkDrag *drag = GDK_DRAG (ddd->base.opaque_context);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
gpointer table_value = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
|
||||
@@ -560,7 +560,7 @@ received_drag_context_data (GObject *drag,
|
||||
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
|
||||
if (!gdk_drag_context_write_finish (GDK_DRAG_CONTEXT (drag), result, &error))
|
||||
if (!gdk_drag_write_finish (GDK_DRAG (drag), result, &error))
|
||||
{
|
||||
HANDLE handle;
|
||||
gboolean is_hdata;
|
||||
@@ -593,7 +593,7 @@ get_data_response (gpointer user_data)
|
||||
{
|
||||
GdkWin32DnDThreadGetData *getdata = (GdkWin32DnDThreadGetData *) user_data;
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
GdkDragContext *drag = GDK_DRAG_CONTEXT (getdata->base.opaque_context);
|
||||
GdkDrag *drag = GDK_DRAG (getdata->base.opaque_context);
|
||||
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("idataobject_getdata will request target 0x%p (%s)",
|
||||
@@ -610,7 +610,7 @@ get_data_response (gpointer user_data)
|
||||
if (stream)
|
||||
{
|
||||
getdata->stream = GDK_WIN32_HDATA_OUTPUT_STREAM (stream);
|
||||
gdk_drag_context_write_async (drag,
|
||||
gdk_drag_write_async (drag,
|
||||
getdata->pair.contentformat,
|
||||
stream,
|
||||
G_PRIORITY_DEFAULT,
|
||||
@@ -721,16 +721,16 @@ typedef enum {
|
||||
|
||||
static gboolean use_ole2_dnd = TRUE;
|
||||
|
||||
static gboolean drag_context_grab (GdkDragContext *drag);
|
||||
static gboolean drag_context_grab (GdkDrag *drag);
|
||||
|
||||
G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
G_DEFINE_TYPE (GdkWin32Drag, gdk_win32_drag, GDK_TYPE_DRAG)
|
||||
|
||||
static void
|
||||
move_drag_surface (GdkDragContext *drag,
|
||||
guint x_root,
|
||||
guint y_root)
|
||||
move_drag_surface (GdkDrag *drag,
|
||||
guint x_root,
|
||||
guint y_root)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
@@ -742,7 +742,7 @@ move_drag_surface (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_init (GdkWin32DragContext *drag)
|
||||
gdk_win32_drag_init (GdkWin32Drag *drag)
|
||||
{
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
@@ -750,32 +750,32 @@ gdk_win32_drag_context_init (GdkWin32DragContext *drag)
|
||||
drag->handle_events = TRUE;
|
||||
drag->dest_window = INVALID_HANDLE_VALUE;
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_init %p\n", drag));
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_init %p\n", drag));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_finalize (GObject *object)
|
||||
gdk_win32_drag_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *drag;
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkSurface *drag_surface;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_finalize %p\n", object));
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_finalize %p\n", object));
|
||||
|
||||
g_return_if_fail (GDK_IS_WIN32_DRAG_CONTEXT (object));
|
||||
g_return_if_fail (GDK_IS_WIN32_DRAG (object));
|
||||
|
||||
drag = GDK_DRAG_CONTEXT (object);
|
||||
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
drag = GDK_DRAG (object);
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
gdk_drag_context_set_cursor (drag, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
|
||||
g_set_object (&drag_win32->grab_surface, NULL);
|
||||
drag_surface = drag_win32->drag_surface;
|
||||
|
||||
G_OBJECT_CLASS (gdk_win32_drag_context_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (gdk_win32_drag_parent_class)->finalize (object);
|
||||
|
||||
if (drag_surface)
|
||||
gdk_surface_destroy (drag_surface);
|
||||
@@ -783,30 +783,32 @@ gdk_win32_drag_context_finalize (GObject *object)
|
||||
|
||||
/* Drag Contexts */
|
||||
|
||||
static GdkDragContext *
|
||||
gdk_drag_context_new (GdkDisplay *display,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
GdkDevice *device,
|
||||
GdkDragProtocol protocol)
|
||||
static GdkDrag *
|
||||
gdk_drag_new (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
GdkDevice *device,
|
||||
GdkDragProtocol protocol)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
|
||||
drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT,
|
||||
"device", device,
|
||||
"content", content,
|
||||
NULL);
|
||||
drag_win32 = g_object_new (GDK_TYPE_WIN32_DRAG,
|
||||
"device", device,
|
||||
"content", content,
|
||||
"surface", surface,
|
||||
"actions", actions,
|
||||
NULL);
|
||||
|
||||
drag = GDK_DRAG_CONTEXT (drag_win32);
|
||||
drag = GDK_DRAG (drag_win32);
|
||||
|
||||
if (win32_display->has_fixed_scale)
|
||||
drag_win32->scale = win32_display->surface_scale;
|
||||
else
|
||||
drag_win32->scale = _gdk_win32_display_get_monitor_scale_factor (win32_display, NULL, NULL, NULL);
|
||||
|
||||
gdk_drag_context_set_actions (drag, actions, actions);
|
||||
drag_win32->protocol = protocol;
|
||||
|
||||
return drag;
|
||||
@@ -828,15 +830,15 @@ gdk_drag_context_new (GdkDisplay *display,
|
||||
|
||||
static enum_formats *enum_formats_new (GArray *formats);
|
||||
|
||||
/* Finds a GdkDragContext object that corresponds to a DnD operation
|
||||
/* Finds a GdkDrag object that corresponds to a DnD operation
|
||||
* which is currently targetting the dest_window
|
||||
* Does not give a reference.
|
||||
*/
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_win32_find_drag_for_dest_window (HWND dest_window)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32DnDThreadDoDragDrop *ddd;
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
|
||||
@@ -844,7 +846,7 @@ _gdk_win32_find_drag_for_dest_window (HWND dest_window)
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &drag_win32, (gpointer *) &ddd))
|
||||
if (ddd->src_context->dest_window_handle == dest_window)
|
||||
return GDK_DRAG_CONTEXT (drag_win32);
|
||||
return GDK_DRAG (drag_win32);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -888,7 +890,7 @@ static gboolean
|
||||
notify_dnd_enter (gpointer user_data)
|
||||
{
|
||||
GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data;
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (notify->opaque_context);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (notify->opaque_context);
|
||||
|
||||
drag_win32->dest_window = notify->target_window_handle;
|
||||
|
||||
@@ -901,7 +903,7 @@ static gboolean
|
||||
notify_dnd_leave (gpointer user_data)
|
||||
{
|
||||
GdkWin32DnDEnterLeaveNotify *notify = (GdkWin32DnDEnterLeaveNotify *) user_data;
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (notify->opaque_context);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (notify->opaque_context);
|
||||
|
||||
if (notify->target_window_handle != drag_win32->dest_window)
|
||||
g_warning ("DnD leave says that the window handle is 0x%p, but drag has 0x%p", notify->target_window_handle, drag_win32->dest_window);
|
||||
@@ -998,7 +1000,7 @@ idropsource_queryinterface (LPDROPSOURCE This,
|
||||
static gboolean
|
||||
unref_context_in_main_thread (gpointer opaque_context)
|
||||
{
|
||||
GdkDragContext *drag = GDK_DRAG_CONTEXT (opaque_context);
|
||||
GdkDrag *drag = GDK_DRAG (opaque_context);
|
||||
|
||||
g_clear_object (&drag);
|
||||
|
||||
@@ -1066,21 +1068,21 @@ idropsource_querycontinuedrag (LPDROPSOURCE This,
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_emit_action_changed (GdkWin32DragContext *drag_win32,
|
||||
maybe_emit_action_changed (GdkWin32Drag *drag_win32,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
if (actions != drag_win32->current_action)
|
||||
{
|
||||
drag_win32->current_action = actions;
|
||||
g_signal_emit_by_name (GDK_DRAG_CONTEXT (drag_win32), "action-changed", actions);
|
||||
gdk_drag_set_selected_action (GDK_DRAG (drag_win32), actions);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
|
||||
_gdk_win32_local_drag_give_feedback (GdkDrag *drag,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
if (drag_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
||||
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
@@ -1088,7 +1090,6 @@ _gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_give_feedback: 0x%p\n",
|
||||
drag));
|
||||
|
||||
drag->action = actions;
|
||||
maybe_emit_action_changed (drag_win32, actions);
|
||||
}
|
||||
|
||||
@@ -1101,14 +1102,13 @@ give_feedback (gpointer user_data)
|
||||
|
||||
if (ddd)
|
||||
{
|
||||
GdkDragContext *drag = GDK_DRAG_CONTEXT (feedback->base.opaque_context);
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkDrag *drag = GDK_DRAG (feedback->base.opaque_context);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_dnd_handle_drag_status: 0x%p\n",
|
||||
drag));
|
||||
|
||||
drag->action = action_for_drop_effect (feedback->received_drop_effect);
|
||||
maybe_emit_action_changed (drag_win32, drag->action);
|
||||
maybe_emit_action_changed (drag_win32, action_for_drop_effect (feedback->received_drop_effect));
|
||||
}
|
||||
|
||||
free_queue_item (&feedback->base);
|
||||
@@ -1587,31 +1587,36 @@ static IEnumFORMATETCVtbl ief_vtbl = {
|
||||
};
|
||||
|
||||
static source_drag_context *
|
||||
source_context_new (GdkDragContext *drag,
|
||||
source_context_new (GdkDrag *drag,
|
||||
GdkContentFormats *formats)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
source_drag_context *result;
|
||||
GdkSurface *surface;
|
||||
|
||||
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
g_object_get (drag, "surface", &surface, NULL);
|
||||
|
||||
result = g_new0 (source_drag_context, 1);
|
||||
result->drag = g_object_ref (drag);
|
||||
result->ids.lpVtbl = &ids_vtbl;
|
||||
result->idsn.lpVtbl = &idsn_vtbl;
|
||||
result->ref_count = 1;
|
||||
result->source_window_handle = GDK_SURFACE_HWND (drag->source_surface);
|
||||
result->source_window_handle = GDK_SURFACE_HWND (surface);
|
||||
result->scale = drag_win32->scale;
|
||||
result->util_data.state = GDK_WIN32_DND_PENDING; /* Implicit */
|
||||
result->dest_window_handle = INVALID_HANDLE_VALUE;
|
||||
|
||||
g_object_unref (surface);
|
||||
|
||||
GDK_NOTE (DND, g_print ("source_context_new: %p (drag %p)\n", result, result->drag));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static data_object *
|
||||
data_object_new (GdkDragContext *drag)
|
||||
data_object_new (GdkDrag *drag)
|
||||
{
|
||||
data_object *result;
|
||||
const char * const *mime_types;
|
||||
@@ -1624,7 +1629,7 @@ data_object_new (GdkDragContext *drag)
|
||||
result->drag = drag;
|
||||
result->formats = g_array_new (FALSE, FALSE, sizeof (GdkWin32ContentFormatPair));
|
||||
|
||||
mime_types = gdk_content_formats_get_mime_types (gdk_drag_context_get_formats (drag), &n_mime_types);
|
||||
mime_types = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_mime_types);
|
||||
|
||||
for (i = 0; i < n_mime_types; i++)
|
||||
{
|
||||
@@ -1701,7 +1706,7 @@ create_drag_surface (GdkDisplay *display)
|
||||
return surface;
|
||||
}
|
||||
|
||||
GdkDragContext *
|
||||
GdkDrag *
|
||||
_gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
@@ -1709,21 +1714,20 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkDragContext *drag;
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
int x_root, y_root;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
|
||||
drag = gdk_drag_context_new (gdk_surface_get_display (surface),
|
||||
content,
|
||||
actions,
|
||||
device,
|
||||
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
|
||||
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
|
||||
g_set_object (&drag->source_surface, surface);
|
||||
drag = gdk_drag_new (gdk_surface_get_display (surface),
|
||||
surface,
|
||||
content,
|
||||
actions,
|
||||
device,
|
||||
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
|
||||
|
||||
@@ -1752,8 +1756,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
source_drag_context *source_ctx;
|
||||
data_object *data_obj;
|
||||
|
||||
source_ctx = source_context_new (drag,
|
||||
gdk_drag_context_get_formats (drag));
|
||||
source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
|
||||
data_obj = data_object_new (drag);
|
||||
|
||||
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
|
||||
@@ -1830,12 +1833,12 @@ find_window_enum_proc (HWND hwnd,
|
||||
* drop targets about drags that move over them.
|
||||
*/
|
||||
static HWND
|
||||
gdk_win32_drag_context_find_window (GdkDragContext *drag,
|
||||
GdkSurface *drag_surface,
|
||||
gint x_root,
|
||||
gint y_root)
|
||||
gdk_win32_drag_find_window (GdkDrag *drag,
|
||||
GdkSurface *drag_surface,
|
||||
gint x_root,
|
||||
gint y_root)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
find_window_enum_arg a;
|
||||
HWND result;
|
||||
|
||||
@@ -1848,14 +1851,14 @@ gdk_win32_drag_context_find_window (GdkDragContext *drag,
|
||||
a.result = INVALID_HANDLE_VALUE;
|
||||
|
||||
GDK_NOTE (DND,
|
||||
g_print ("gdk_win32_drag_context_find_window: %p %+d%+d\n",
|
||||
g_print ("gdk_win32_drag_find_window: %p %+d%+d\n",
|
||||
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
|
||||
a.x, a.y));
|
||||
|
||||
EnumWindows (find_window_enum_proc, (LPARAM) &a);
|
||||
|
||||
GDK_NOTE (DND,
|
||||
g_print ("gdk_win32_drag_context_find_window: %p %+d%+d: %p\n",
|
||||
g_print ("gdk_win32_drag_find_window: %p %+d%+d: %p\n",
|
||||
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
|
||||
x_root, y_root,
|
||||
a.result));
|
||||
@@ -1900,7 +1903,7 @@ _gdk_win32_get_drop_for_dest_window (HWND dest_window)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
gdk_win32_local_drag_motion (GdkDrag *drag,
|
||||
HWND dest_window,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
@@ -1908,7 +1911,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
DWORD key_state,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32;
|
||||
GdkWin32Drag *drag_win32;
|
||||
GdkDrop *drop;
|
||||
GdkDragAction actions;
|
||||
|
||||
@@ -1917,20 +1920,19 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
|
||||
g_return_val_if_fail (drag != NULL, FALSE);
|
||||
|
||||
drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
|
||||
|
||||
actions = gdk_drag_context_get_actions (drag);
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n"
|
||||
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,suggested=%s,action=%s}\n",
|
||||
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,action=%s}\n",
|
||||
x_root, y_root,
|
||||
_gdk_win32_drag_action_to_string (possible_actions),
|
||||
dest_window, drag_win32->dest_window, drop, drag,
|
||||
_gdk_win32_drag_action_to_string (actions),
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_context_get_suggested_action (drag)),
|
||||
_gdk_win32_drag_action_to_string (drag->action)));
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
|
||||
|
||||
if (drag_win32->dest_window != dest_window)
|
||||
{
|
||||
@@ -1962,7 +1964,7 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
drag_win32->drag_status == GDK_DRAG_STATUS_DRAG &&
|
||||
_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, key_state))
|
||||
{
|
||||
actions = gdk_drag_context_get_actions (drag);
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
drag_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
||||
|
||||
_gdk_win32_local_drop_target_dragover (drop, drag, x_root, y_root, key_state, time_, &actions);
|
||||
@@ -1971,34 +1973,33 @@ gdk_win32_local_drag_motion (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
GDK_NOTE (DND, g_print (" returning %s\n"
|
||||
" drag=%p:{actions=%s,suggested=%s,action=%s}\n",
|
||||
" drag=%p:{actions=%s,action=%s}\n",
|
||||
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
|
||||
drag,
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_context_get_actions (drag)),
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_context_get_suggested_action (drag)),
|
||||
_gdk_win32_drag_action_to_string (drag->action)));
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_actions (drag)),
|
||||
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
|
||||
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
|
||||
}
|
||||
|
||||
static void
|
||||
send_source_state_update (GdkWin32Clipdrop *clipdrop,
|
||||
GdkWin32DragContext *context_win32,
|
||||
GdkWin32Drag *drag_win32,
|
||||
gpointer *ddd)
|
||||
{
|
||||
GdkWin32DnDThreadUpdateDragState *status = g_new0 (GdkWin32DnDThreadUpdateDragState, 1);
|
||||
status->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_UPDATE_DRAG_STATE;
|
||||
status->opaque_ddd = ddd;
|
||||
status->produced_util_data = context_win32->util_data;
|
||||
status->produced_util_data = drag_win32->util_data;
|
||||
increment_dnd_queue_counter ();
|
||||
g_async_queue_push (clipdrop->dnd_queue, status);
|
||||
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
guint32 time_)
|
||||
gdk_win32_drag_drop (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
@@ -2006,7 +2007,7 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
|
||||
g_return_if_fail (drag != NULL);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drag_drop\n"));
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop\n"));
|
||||
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
|
||||
{
|
||||
@@ -2016,10 +2017,10 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
{
|
||||
GdkDragAction actions;
|
||||
|
||||
actions = gdk_drag_context_get_actions (drag);
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
_gdk_win32_local_drop_target_drop (drop, drag, time_, &actions);
|
||||
maybe_emit_action_changed (drag_win32, actions);
|
||||
_gdk_win32_local_drag_context_drop_response (drag, actions);
|
||||
_gdk_win32_local_drag_drop_response (drag, actions);
|
||||
}
|
||||
}
|
||||
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
@@ -2034,37 +2035,12 @@ gdk_win32_drag_context_drag_drop (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drag_abort (GdkDragContext *drag,
|
||||
guint32 time_)
|
||||
gdk_win32_drag_set_cursor (GdkDrag *drag,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
g_return_if_fail (drag != NULL);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drag_abort\n"));
|
||||
|
||||
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
|
||||
{
|
||||
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
|
||||
|
||||
drag_win32->util_data.state = GDK_WIN32_DND_NONE;
|
||||
|
||||
if (ddd)
|
||||
send_source_state_update (clipdrop, drag_win32, ddd);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_set_cursor (GdkDragContext *drag,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_set_cursor: 0x%p 0x%p\n", drag, cursor));
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_set_cursor: 0x%p 0x%p\n", drag, cursor));
|
||||
|
||||
if (!g_set_object (&drag_win32->cursor, cursor))
|
||||
return;
|
||||
@@ -2092,7 +2068,7 @@ ease_out_cubic (double t)
|
||||
|
||||
typedef struct _GdkDragAnim GdkDragAnim;
|
||||
struct _GdkDragAnim {
|
||||
GdkWin32DragContext *drag;
|
||||
GdkWin32Drag *drag;
|
||||
GdkFrameClock *frame_clock;
|
||||
gint64 start_time;
|
||||
};
|
||||
@@ -2108,7 +2084,7 @@ static gboolean
|
||||
gdk_drag_anim_timeout (gpointer data)
|
||||
{
|
||||
GdkDragAnim *anim = data;
|
||||
GdkWin32DragContext *drag = anim->drag;
|
||||
GdkWin32Drag *drag = anim->drag;
|
||||
GdkFrameClock *frame_clock = anim->frame_clock;
|
||||
gint64 current_time;
|
||||
double f;
|
||||
@@ -2136,10 +2112,10 @@ gdk_drag_anim_timeout (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
gboolean success)
|
||||
gdk_win32_drag_drop_done (GdkDrag *drag,
|
||||
gboolean success)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkDragAnim *anim;
|
||||
/*
|
||||
cairo_surface_t *win_surface;
|
||||
@@ -2148,7 +2124,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
*/
|
||||
guint id;
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_done: 0x%p %s\n",
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: 0x%p %s\n",
|
||||
drag,
|
||||
success ? "dropped successfully" : "dropped unsuccessfully"));
|
||||
|
||||
@@ -2207,7 +2183,7 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
anim->frame_clock = gdk_surface_get_frame_clock (drag_win32->drag_surface);
|
||||
anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_done: animate the drag window from %d : %d to %d : %d\n",
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: animate the drag window from %d : %d to %d : %d\n",
|
||||
drag_win32->util_data.last_x, drag_win32->util_data.last_y,
|
||||
drag_win32->start_x, drag_win32->start_y));
|
||||
|
||||
@@ -2218,9 +2194,9 @@ gdk_win32_drag_context_drop_done (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
drag_context_grab (GdkDragContext *drag)
|
||||
drag_context_grab (GdkDrag *drag)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkSeatCapabilities capabilities;
|
||||
GdkSeat *seat;
|
||||
GdkCursor *cursor;
|
||||
@@ -2232,11 +2208,11 @@ drag_context_grab (GdkDragContext *drag)
|
||||
if (!drag_win32->grab_surface)
|
||||
return FALSE;
|
||||
|
||||
seat = gdk_device_get_seat (gdk_drag_context_get_device (drag));
|
||||
seat = gdk_device_get_seat (gdk_drag_get_device (drag));
|
||||
|
||||
capabilities = GDK_SEAT_CAPABILITY_ALL;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, gdk_drag_context_get_selected_action (drag));
|
||||
cursor = gdk_drag_get_cursor (drag, gdk_drag_get_selected_action (drag));
|
||||
g_set_object (&drag_win32->cursor, cursor);
|
||||
|
||||
if (gdk_seat_grab (seat, drag_win32->grab_surface,
|
||||
@@ -2252,9 +2228,9 @@ drag_context_grab (GdkDragContext *drag)
|
||||
}
|
||||
|
||||
static void
|
||||
drag_context_ungrab (GdkDragContext *drag)
|
||||
drag_context_ungrab (GdkDrag *drag)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("drag_context_ungrab: 0x%p 0x%p\n",
|
||||
drag,
|
||||
@@ -2271,10 +2247,10 @@ drag_context_ungrab (GdkDragContext *drag)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_cancel (GdkDragContext *drag,
|
||||
GdkDragCancelReason reason)
|
||||
gdk_win32_drag_cancel (GdkDrag *drag,
|
||||
GdkDragCancelReason reason)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
const gchar *reason_str = NULL;
|
||||
switch (reason)
|
||||
@@ -2293,7 +2269,7 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
|
||||
break;
|
||||
}
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_cancel: 0x%p %s\n",
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_cancel: 0x%p %s\n",
|
||||
drag,
|
||||
reason_str));
|
||||
|
||||
@@ -2305,20 +2281,21 @@ gdk_win32_drag_context_cancel (GdkDragContext *drag,
|
||||
drop = NULL;
|
||||
}
|
||||
|
||||
gdk_drag_context_set_cursor (drag, NULL);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
drag_context_ungrab (drag);
|
||||
gdk_drag_drop_done (drag, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
|
||||
guint32 time_)
|
||||
gdk_win32_drag_drop_performed (GdkDrag *drag,
|
||||
guint32 time_)
|
||||
{
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_context_drop_performed: 0x%p %u\n",
|
||||
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_performed: 0x%p %u\n",
|
||||
drag,
|
||||
time_));
|
||||
gdk_drag_drop (drag, time_);
|
||||
gdk_drag_context_set_cursor (drag, NULL);
|
||||
|
||||
gdk_win32_drag_drop (drag, time_);
|
||||
gdk_drag_set_cursor (drag, NULL);
|
||||
drag_context_ungrab (drag);
|
||||
}
|
||||
|
||||
@@ -2326,33 +2303,33 @@ gdk_win32_drag_context_drop_performed (GdkDragContext *drag,
|
||||
#define SMALL_STEP 1
|
||||
|
||||
static void
|
||||
gdk_local_drag_update (GdkDragContext *drag,
|
||||
gdouble x_root,
|
||||
gdouble y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 evtime)
|
||||
gdk_local_drag_update (GdkDrag *drag,
|
||||
gdouble x_root,
|
||||
gdouble y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 evtime)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
HWND dest_window;
|
||||
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
dest_window = gdk_win32_drag_context_find_window (drag,
|
||||
drag_win32->drag_surface,
|
||||
x_root, y_root);
|
||||
dest_window = gdk_win32_drag_find_window (drag,
|
||||
drag_win32->drag_surface,
|
||||
x_root, y_root);
|
||||
|
||||
gdk_win32_local_drag_motion (drag, dest_window, x_root, y_root,
|
||||
gdk_drag_context_get_actions (drag),
|
||||
gdk_drag_get_actions (drag),
|
||||
grfKeyState, evtime);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_motion_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_motion_event (GdkDrag *drag,
|
||||
const GdkEventMotion *event)
|
||||
{
|
||||
GdkModifierType state;
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
DWORD key_state;
|
||||
|
||||
if (!gdk_event_get_state ((GdkEvent *) event, &state))
|
||||
@@ -2391,10 +2368,10 @@ gdk_dnd_handle_motion_event (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_key_event (GdkDrag *drag,
|
||||
const GdkEventKey *event)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
GdkModifierType state;
|
||||
GdkDevice *pointer;
|
||||
gint dx, dy;
|
||||
@@ -2413,7 +2390,7 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_KEY_Escape:
|
||||
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_USER_CANCELLED);
|
||||
return TRUE;
|
||||
|
||||
case GDK_KEY_space:
|
||||
@@ -2421,13 +2398,13 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
case GDK_KEY_ISO_Enter:
|
||||
case GDK_KEY_KP_Enter:
|
||||
case GDK_KEY_KP_Space:
|
||||
if ((gdk_drag_context_get_selected_action (drag) != 0) &&
|
||||
if ((gdk_drag_get_selected_action (drag) != 0) &&
|
||||
(drag_win32->dest_window != INVALID_HANDLE_VALUE))
|
||||
{
|
||||
g_signal_emit_by_name (drag, "drop-performed");
|
||||
}
|
||||
else
|
||||
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -2477,10 +2454,10 @@ gdk_dnd_handle_key_event (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_grab_broken_event (GdkDrag *drag,
|
||||
const GdkEventGrabBroken *event)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_dnd_handle_grab_broken_event: 0x%p\n",
|
||||
drag));
|
||||
@@ -2495,15 +2472,15 @@ gdk_dnd_handle_grab_broken_event (GdkDragContext *drag,
|
||||
return FALSE;
|
||||
|
||||
if (gdk_event_get_device ((GdkEvent *) event) !=
|
||||
gdk_drag_context_get_device (drag))
|
||||
gdk_drag_get_device (drag))
|
||||
return FALSE;
|
||||
|
||||
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_ERROR);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_ERROR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_dnd_handle_button_event (GdkDragContext *drag,
|
||||
gdk_dnd_handle_button_event (GdkDrag *drag,
|
||||
const GdkEventButton *event)
|
||||
{
|
||||
GDK_NOTE (DND, g_print ("gdk_dnd_handle_button_event: 0x%p\n",
|
||||
@@ -2515,22 +2492,22 @@ gdk_dnd_handle_button_event (GdkDragContext *drag,
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if ((gdk_drag_context_get_selected_action (drag) != 0))
|
||||
if ((gdk_drag_get_selected_action (drag) != 0))
|
||||
{
|
||||
g_signal_emit_by_name (drag, "drop-performed");
|
||||
}
|
||||
else
|
||||
gdk_drag_context_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
gdk_drag_cancel (drag, GDK_DRAG_CANCEL_NO_TARGET);
|
||||
|
||||
/* Make sure GTK gets mouse release button event */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_win32_drag_context_handle_event (GdkDragContext *drag,
|
||||
const GdkEvent *event)
|
||||
gdk_win32_drag_handle_event (GdkDrag *drag,
|
||||
const GdkEvent *event)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
if (!drag_win32->grab_seat)
|
||||
return FALSE;
|
||||
@@ -2559,30 +2536,20 @@ gdk_win32_drag_context_handle_event (GdkDragContext *drag,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_win32_drag_context_action_changed (GdkDragContext *drag,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkCursor *cursor;
|
||||
|
||||
cursor = gdk_drag_get_cursor (drag, action);
|
||||
gdk_drag_context_set_cursor (drag, cursor);
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
gdk_win32_drag_context_get_drag_surface (GdkDragContext *drag)
|
||||
gdk_win32_drag_get_drag_surface (GdkDrag *drag)
|
||||
{
|
||||
return GDK_WIN32_DRAG_CONTEXT (drag)->drag_surface;
|
||||
return GDK_WIN32_DRAG (drag)->drag_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
gdk_win32_drag_set_hotspot (GdkDrag *drag,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
GdkWin32DragContext *drag_win32 = GDK_WIN32_DRAG_CONTEXT (drag);
|
||||
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_drag_context_set_hotspot: 0x%p %d:%d\n",
|
||||
GDK_NOTE (DND, g_print ("gdk_drag_set_hotspot: 0x%p %d:%d\n",
|
||||
drag,
|
||||
hot_x, hot_y));
|
||||
|
||||
@@ -2597,23 +2564,18 @@ gdk_win32_drag_context_set_hotspot (GdkDragContext *drag,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
|
||||
gdk_win32_drag_class_init (GdkWin32DragClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
GdkDragClass *drag_class = GDK_DRAG_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_win32_drag_context_finalize;
|
||||
|
||||
context_class->drag_abort = gdk_win32_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_win32_drag_context_drag_drop;
|
||||
|
||||
context_class->get_drag_surface = gdk_win32_drag_context_get_drag_surface;
|
||||
context_class->set_hotspot = gdk_win32_drag_context_set_hotspot;
|
||||
context_class->drop_done = gdk_win32_drag_context_drop_done;
|
||||
context_class->set_cursor = gdk_win32_drag_context_set_cursor;
|
||||
context_class->cancel = gdk_win32_drag_context_cancel;
|
||||
context_class->drop_performed = gdk_win32_drag_context_drop_performed;
|
||||
context_class->handle_event = gdk_win32_drag_context_handle_event;
|
||||
context_class->action_changed = gdk_win32_drag_context_action_changed;
|
||||
object_class->finalize = gdk_win32_drag_finalize;
|
||||
|
||||
drag_class->get_drag_surface = gdk_win32_drag_get_drag_surface;
|
||||
drag_class->set_hotspot = gdk_win32_drag_set_hotspot;
|
||||
drag_class->drop_done = gdk_win32_drag_drop_done;
|
||||
drag_class->set_cursor = gdk_win32_drag_set_cursor;
|
||||
drag_class->cancel = gdk_win32_drag_cancel;
|
||||
drag_class->drop_performed = gdk_win32_drag_drop_performed;
|
||||
drag_class->handle_event = gdk_win32_drag_handle_event;
|
||||
}
|
||||
|
||||
+11
-11
@@ -41,7 +41,7 @@
|
||||
|
||||
#include "gdkdropprivate.h"
|
||||
|
||||
#include "gdkdnd.h"
|
||||
#include "gdkdrag.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
@@ -172,7 +172,7 @@ gdk_win32_drop_finalize (GObject *object)
|
||||
static GdkDrop *
|
||||
gdk_drop_new (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
GdkContentFormats *formats,
|
||||
GdkSurface *surface,
|
||||
GdkDragProtocol protocol)
|
||||
@@ -453,7 +453,7 @@ set_source_actions_helper (GdkDrop *drop,
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
_gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
|
||||
GdkSurface *dest_surface,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
@@ -478,7 +478,7 @@ _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
drop = gdk_drop_new (display,
|
||||
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
|
||||
drag,
|
||||
gdk_content_formats_ref (gdk_drag_context_get_formats (drag)),
|
||||
gdk_content_formats_ref (gdk_drag_get_formats (drag)),
|
||||
dest_surface,
|
||||
GDK_DRAG_PROTO_LOCAL);
|
||||
drop_win32 = GDK_WIN32_DROP (drop);
|
||||
@@ -518,7 +518,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
GdkDisplay *display;
|
||||
gint pt_x;
|
||||
gint pt_y;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkDragAction source_actions;
|
||||
GdkDragAction dest_actions;
|
||||
|
||||
@@ -531,7 +531,7 @@ idroptarget_dragenter (LPDROPTARGET This,
|
||||
|
||||
g_clear_object (&ctx->drop);
|
||||
|
||||
/* Try to find the GdkDragContext object for this DnD operation,
|
||||
/* Try to find the GdkDrag object for this DnD operation,
|
||||
* if it originated in our own application.
|
||||
*/
|
||||
drag = NULL;
|
||||
@@ -593,7 +593,7 @@ _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_dragover (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
DWORD grfKeyState,
|
||||
@@ -710,7 +710,7 @@ idroptarget_dragleave (LPDROPTARGET This)
|
||||
|
||||
void
|
||||
_gdk_win32_local_drop_target_drop (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions)
|
||||
{
|
||||
@@ -1065,7 +1065,7 @@ gdk_win32_drop_status (GdkDrop *drop,
|
||||
GdkDragAction actions)
|
||||
{
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
|
||||
g_return_if_fail (drop != NULL);
|
||||
|
||||
@@ -1090,7 +1090,7 @@ static void
|
||||
gdk_win32_drop_finish (GdkDrop *drop,
|
||||
GdkDragAction action)
|
||||
{
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
|
||||
|
||||
g_return_if_fail (drop != NULL);
|
||||
@@ -1107,7 +1107,7 @@ gdk_win32_drop_finish (GdkDrop *drop,
|
||||
drag = gdk_drop_get_drag (drop);
|
||||
|
||||
if (drag != NULL)
|
||||
_gdk_win32_local_drag_context_drop_response (drag, action);
|
||||
_gdk_win32_local_drag_drop_response (drag, action);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
//#include "gdkselection-win32.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
@@ -777,7 +777,6 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
CASE (GDK_NOTHING);
|
||||
CASE (GDK_DELETE);
|
||||
CASE (GDK_DESTROY);
|
||||
CASE (GDK_EXPOSE);
|
||||
CASE (GDK_MOTION_NOTIFY);
|
||||
CASE (GDK_BUTTON_PRESS);
|
||||
CASE (GDK_BUTTON_RELEASE);
|
||||
@@ -786,9 +785,6 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
CASE (GDK_ENTER_NOTIFY);
|
||||
CASE (GDK_LEAVE_NOTIFY);
|
||||
CASE (GDK_FOCUS_CHANGE);
|
||||
CASE (GDK_CONFIGURE);
|
||||
CASE (GDK_MAP);
|
||||
CASE (GDK_UNMAP);
|
||||
CASE (GDK_PROXIMITY_IN);
|
||||
CASE (GDK_PROXIMITY_OUT);
|
||||
CASE (GDK_DRAG_ENTER);
|
||||
@@ -807,8 +803,6 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
|
||||
switch (event->any.type)
|
||||
{
|
||||
case GDK_EXPOSE:
|
||||
break;
|
||||
case GDK_MOTION_NOTIFY:
|
||||
g_print ("(%.4g,%.4g) (%.4g,%.4g)",
|
||||
event->motion.x, event->motion.y,
|
||||
@@ -861,11 +855,6 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
case GDK_FOCUS_CHANGE:
|
||||
g_print ("%s", (event->focus_change.in ? "IN" : "OUT"));
|
||||
break;
|
||||
case GDK_CONFIGURE:
|
||||
g_print ("x:%d y:%d w:%d h:%d",
|
||||
event->configure.x, event->configure.y,
|
||||
event->configure.width, event->configure.height);
|
||||
break;
|
||||
case GDK_DRAG_ENTER:
|
||||
case GDK_DRAG_LEAVE:
|
||||
case GDK_DRAG_MOTION:
|
||||
@@ -873,7 +862,7 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
if (event->dnd.drop != NULL)
|
||||
g_print ("ctx:%p: %s",
|
||||
event->dnd.drop,
|
||||
_gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG_CONTEXT (event->dnd.drop)->protocol));
|
||||
_gdk_win32_drag_protocol_to_string (GDK_WIN32_DRAG (event->dnd.drop)->protocol));
|
||||
break;
|
||||
case GDK_SCROLL:
|
||||
g_print ("(%.4g,%.4g) (%.4g,%.4g) %s ",
|
||||
@@ -1429,17 +1418,7 @@ _gdk_win32_do_emit_configure_event (GdkSurface *window,
|
||||
|
||||
_gdk_surface_update_size (window);
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
|
||||
event->any.surface = window;
|
||||
|
||||
event->configure.width = window->width;
|
||||
event->configure.height = window->height;
|
||||
|
||||
event->configure.x = window->x;
|
||||
event->configure.y = window->y;
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
g_signal_emit_by_name (window, "size-changed", window->width, window->height);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3125,15 +3104,6 @@ gdk_event_translate (MSG *msg,
|
||||
gdk_device_ungrab (device, msg -> time);
|
||||
}
|
||||
|
||||
/* Send MAP events */
|
||||
if ((windowpos->flags & SWP_SHOWWINDOW) &&
|
||||
!GDK_SURFACE_DESTROYED (window))
|
||||
{
|
||||
event = gdk_event_new (GDK_MAP);
|
||||
event->any.surface = window;
|
||||
_gdk_win32_append_event (event);
|
||||
}
|
||||
|
||||
/* Update window state */
|
||||
if (windowpos->flags & (SWP_STATECHANGED | SWP_SHOWWINDOW | SWP_HIDEWINDOW))
|
||||
{
|
||||
@@ -3192,11 +3162,6 @@ gdk_event_translate (MSG *msg,
|
||||
if ((windowpos->flags & SWP_HIDEWINDOW) &&
|
||||
!GDK_SURFACE_DESTROYED (window))
|
||||
{
|
||||
/* Send UNMAP events */
|
||||
event = gdk_event_new (GDK_UNMAP);
|
||||
event->any.surface = window;
|
||||
_gdk_win32_append_event (event);
|
||||
|
||||
/* Make transient parent the forground window when window unmaps */
|
||||
impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
|
||||
|
||||
|
||||
@@ -423,12 +423,12 @@ void _gdk_win32_display_create_surface_impl (GdkDisplay *display,
|
||||
void _gdk_win32_surface_register_dnd (GdkSurface *window);
|
||||
void _gdk_win32_surface_unregister_dnd (GdkSurface *window);
|
||||
|
||||
GdkDragContext *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
|
||||
/* Stray GdkWin32Screen members */
|
||||
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkWin32DragContextUtilityData GdkWin32DragContextUtilityData;
|
||||
typedef struct _GdkWin32DragUtilityData GdkWin32DragUtilityData;
|
||||
|
||||
/* This structure is deliberately designed to be
|
||||
* copyable with memcpy(), i.e. no pointers inside.
|
||||
*/
|
||||
struct _GdkWin32DragContextUtilityData
|
||||
struct _GdkWin32DragUtilityData
|
||||
{
|
||||
gint last_x; /* Coordinates from last event, in GDK space */
|
||||
gint last_y;
|
||||
@@ -39,15 +39,15 @@ struct _GdkWin32DragContextUtilityData
|
||||
GdkWin32DndState state;
|
||||
};
|
||||
|
||||
struct _GdkWin32DragContext
|
||||
struct _GdkWin32Drag
|
||||
{
|
||||
GdkDragContext drag;
|
||||
GdkDrag drag;
|
||||
|
||||
/* The drag protocol being used */
|
||||
GdkDragProtocol protocol;
|
||||
|
||||
/* The surface used for grabs.
|
||||
* Usually the same as GdkDragContext->source_surface
|
||||
* Usually the same as GdkDrag->source_surface
|
||||
*/
|
||||
GdkSurface *grab_surface;
|
||||
|
||||
@@ -71,7 +71,7 @@ struct _GdkWin32DragContext
|
||||
*/
|
||||
GdkDragAction current_action;
|
||||
|
||||
GdkWin32DragContextUtilityData util_data;
|
||||
GdkWin32DragUtilityData util_data;
|
||||
|
||||
guint scale; /* Temporarily caches the HiDPI scale */
|
||||
gint hot_x; /* Hotspot offset from the top-left of the drag-window, scaled (can be added to GDK space coordinates) */
|
||||
@@ -84,23 +84,23 @@ struct _GdkWin32DragContext
|
||||
guint handle_events : 1; /* Whether handle_event() should do anything */
|
||||
};
|
||||
|
||||
struct _GdkWin32DragContextClass
|
||||
struct _GdkWin32DragClass
|
||||
{
|
||||
GdkDragContextClass parent_class;
|
||||
GdkDragClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
gpointer _gdk_win32_dnd_thread_main (gpointer data);
|
||||
|
||||
GdkDragContext *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
|
||||
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
|
||||
GdkDrag *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
|
||||
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
|
||||
|
||||
gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
DWORD grfKeyState);
|
||||
|
||||
void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
void _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
|
||||
GdkSurface *dest_surface,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
@@ -108,22 +108,22 @@ void _gdk_win32_local_drop_target_dragenter (GdkDragContext *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
void _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
DWORD grfKeyState,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
|
||||
guint32 time_);
|
||||
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
|
||||
guint32 time_);
|
||||
void _gdk_win32_local_drop_target_drop (GdkDrop *drop,
|
||||
GdkDragContext *drag,
|
||||
GdkDrag *drag,
|
||||
guint32 time_,
|
||||
GdkDragAction *actions);
|
||||
|
||||
void _gdk_win32_local_drag_give_feedback (GdkDragContext *drag,
|
||||
void _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
|
||||
GdkDragAction actions);
|
||||
void _gdk_win32_local_drag_context_drop_response (GdkDragContext *drag,
|
||||
void _gdk_win32_local_drag_drop_response (GdkDrag *drag,
|
||||
GdkDragAction action);
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -26,23 +26,23 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_WIN32_DRAG_CONTEXT (gdk_win32_drag_context_get_type ())
|
||||
#define GDK_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContext))
|
||||
#define GDK_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
|
||||
#define GDK_IS_WIN32_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG_CONTEXT))
|
||||
#define GDK_IS_WIN32_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT))
|
||||
#define GDK_WIN32_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
|
||||
#define GDK_TYPE_WIN32_DRAG (gdk_win32_drag_get_type ())
|
||||
#define GDK_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG, GdkWin32Drag))
|
||||
#define GDK_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
|
||||
#define GDK_IS_WIN32_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG))
|
||||
#define GDK_IS_WIN32_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG))
|
||||
#define GDK_WIN32_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG, GdkWin32DragClass))
|
||||
|
||||
#ifdef GDK_COMPILATION
|
||||
typedef struct _GdkWin32DragContext GdkWin32DragContext;
|
||||
typedef struct _GdkWin32Drag GdkWin32Drag;
|
||||
#else
|
||||
typedef GdkDragContext GdkWin32DragContext;
|
||||
typedef GdkDrag GdkWin32Drag;
|
||||
#endif
|
||||
typedef struct _GdkWin32DragContextClass GdkWin32DragContextClass;
|
||||
typedef struct _GdkWin32DragClass GdkWin32DragClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_win32_drag_context_get_type (void);
|
||||
GType gdk_win32_drag_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WIN32_DRAG_CONTEXT_H__ */
|
||||
#endif /* __GDK_WIN32_DRAG_H__ */
|
||||
|
||||
@@ -491,6 +491,14 @@ gdk_x11_clipboard_xevent (GdkDisplay *display,
|
||||
if (sn->selection != cb->xselection)
|
||||
return FALSE;
|
||||
|
||||
if (sn->selection_timestamp < cb->timestamp)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, CLIPBOARD,
|
||||
g_printerr ("%s: Ignoring XFixesSelectionNotify with too old timestamp (%lu vs %lu)\n",
|
||||
cb->selection, sn->selection_timestamp, cb->timestamp));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (sn->owner == GDK_X11_DISPLAY (display)->leader_window)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, CLIPBOARD,
|
||||
|
||||
@@ -1104,8 +1104,7 @@ translate_axes (GdkDevice *device,
|
||||
gdouble *axes;
|
||||
gdouble *vals;
|
||||
|
||||
g_object_get (device, "n-axes", &n_axes, NULL);
|
||||
|
||||
n_axes = gdk_device_get_n_axes (device);
|
||||
axes = g_new0 (gdouble, n_axes);
|
||||
vals = valuators->values;
|
||||
|
||||
|
||||
@@ -848,9 +848,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
g_message ("unmap notify:\t\twindow: %ld",
|
||||
xevent->xmap.window));
|
||||
|
||||
event->any.type = GDK_UNMAP;
|
||||
event->any.surface = surface;
|
||||
|
||||
if (surface && !is_substructure)
|
||||
{
|
||||
/* If the WM supports the _NET_WM_STATE_HIDDEN hint, we do not want to
|
||||
@@ -885,6 +882,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
_gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial);
|
||||
}
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case MapNotify:
|
||||
@@ -892,9 +891,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
g_message ("map notify:\t\twindow: %ld",
|
||||
xevent->xmap.window));
|
||||
|
||||
event->any.type = GDK_MAP;
|
||||
event->any.surface = surface;
|
||||
|
||||
if (surface && !is_substructure)
|
||||
{
|
||||
/* Unset iconified if it was set */
|
||||
@@ -907,6 +903,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
||||
gdk_surface_thaw_toplevel_updates (surface);
|
||||
}
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case ReparentNotify:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@
|
||||
#include "gdkclipboard-x11.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkproperty.h"
|
||||
@@ -336,7 +336,7 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
|
||||
{
|
||||
GdkX11Drop *drop_x11 = GDK_X11_DROP (drop);
|
||||
GdkDisplay *display = gdk_drop_get_display (drop);
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkDragAction actions = GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK;
|
||||
Atom type;
|
||||
int format;
|
||||
@@ -398,7 +398,7 @@ gdk_x11_drop_read_actions (GdkDrop *drop)
|
||||
}
|
||||
else
|
||||
{
|
||||
actions = gdk_drag_context_get_actions (drag);
|
||||
actions = gdk_drag_get_actions (drag);
|
||||
drop_x11->xdnd_have_actions = TRUE;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ xdnd_enter_filter (GdkSurface *surface,
|
||||
GdkX11Display *display_x11;
|
||||
GdkDrop *drop;
|
||||
GdkX11Drop *drop_x11;
|
||||
GdkDragContext *drag;
|
||||
GdkDrag *drag;
|
||||
GdkSeat *seat;
|
||||
gint i;
|
||||
Atom type;
|
||||
@@ -548,7 +548,7 @@ xdnd_enter_filter (GdkSurface *surface,
|
||||
print_target_list (content_formats);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
drag = gdk_x11_drag_context_find (display, source_window, GDK_SURFACE_XID (surface));
|
||||
drag = gdk_x11_drag_find (display, source_window, GDK_SURFACE_XID (surface));
|
||||
|
||||
drop_x11 = g_object_new (GDK_TYPE_X11_DROP,
|
||||
"device", gdk_seat_get_pointer (seat),
|
||||
@@ -768,7 +768,7 @@ gdk_x11_drop_status (GdkDrop *drop,
|
||||
|
||||
if (gdk_drop_get_drag (drop))
|
||||
{
|
||||
gdk_x11_drag_context_handle_status (display, &xev);
|
||||
gdk_x11_drag_handle_status (display, &xev);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -821,7 +821,7 @@ gdk_x11_drop_finish (GdkDrop *drop,
|
||||
|
||||
if (gdk_drop_get_drag (drop))
|
||||
{
|
||||
gdk_x11_drag_context_handle_status (display, &xev);
|
||||
gdk_x11_drag_handle_status (display, &xev);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -849,7 +849,7 @@ gdk_x11_drop_class_init (GdkX11DropClass *klass)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_drop_init (GdkX11Drop *context)
|
||||
gdk_x11_drop_init (GdkX11Drop *drag)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -196,16 +196,16 @@ Atom _gdk_x11_get_xatom_for_display_printf (GdkDisplay *display,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
|
||||
GdkDragContext *gdk_x11_drag_context_find (GdkDisplay *display,
|
||||
Window source_xid,
|
||||
Window dest_xid);
|
||||
void gdk_x11_drag_context_handle_status (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drag_context_handle_finished (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drop_read_actions (GdkDrop *drop);
|
||||
gboolean gdk_x11_drop_filter (GdkSurface *surface,
|
||||
const XEvent *xevent);
|
||||
GdkDrag *gdk_x11_drag_find (GdkDisplay *display,
|
||||
Window source_xid,
|
||||
Window dest_xid);
|
||||
void gdk_x11_drag_handle_status (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drag_handle_finished (GdkDisplay *display,
|
||||
const XEvent *xevent);
|
||||
void gdk_x11_drop_read_actions (GdkDrop *drop);
|
||||
gboolean gdk_x11_drop_filter (GdkSurface *surface,
|
||||
const XEvent *xevent);
|
||||
|
||||
typedef struct _GdkSurfaceCache GdkSurfaceCache;
|
||||
|
||||
@@ -225,7 +225,7 @@ void _gdk_x11_cursor_display_finalize (GdkDisplay *display);
|
||||
|
||||
void _gdk_x11_surface_register_dnd (GdkSurface *window);
|
||||
|
||||
GdkDragContext * _gdk_x11_surface_drag_begin (GdkSurface *window,
|
||||
GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
|
||||
+31
-39
@@ -880,16 +880,8 @@ _gdk_x11_display_create_surface_impl (GdkDisplay *display,
|
||||
{
|
||||
class = InputOutput;
|
||||
|
||||
if (gdk_display_is_rgba (display))
|
||||
{
|
||||
xattributes.background_pixel = 0;
|
||||
xattributes_mask |= CWBackPixel;
|
||||
}
|
||||
else
|
||||
{
|
||||
xattributes.background_pixmap = None;
|
||||
xattributes_mask |= CWBackPixmap;
|
||||
}
|
||||
xattributes.background_pixmap = None;
|
||||
xattributes_mask |= CWBackPixmap;
|
||||
|
||||
xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
|
||||
xattributes_mask |= CWBorderPixel;
|
||||
@@ -1292,35 +1284,6 @@ gdk_surface_x11_show (GdkSurface *surface, gboolean already_mapped)
|
||||
gdk_x11_surface_apply_fullscreen_mode (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_hide (GdkSurface *surface)
|
||||
{
|
||||
/* We'll get the unmap notify eventually, and handle it then,
|
||||
* but checking here makes things more consistent if we are
|
||||
* just doing stuff ourself.
|
||||
*/
|
||||
_gdk_x11_surface_grab_check_unmap (surface,
|
||||
NextRequest (GDK_SURFACE_XDISPLAY (surface)));
|
||||
|
||||
/* You can't simply unmap toplevel surfaces. */
|
||||
switch (surface->surface_type)
|
||||
{
|
||||
case GDK_SURFACE_TOPLEVEL:
|
||||
case GDK_SURFACE_TEMP: /* ? */
|
||||
gdk_surface_withdraw (surface);
|
||||
return;
|
||||
|
||||
case GDK_SURFACE_CHILD:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_gdk_surface_clear_update_area (surface);
|
||||
|
||||
XUnmapWindow (GDK_SURFACE_XDISPLAY (surface),
|
||||
GDK_SURFACE_XID (surface));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_withdraw (GdkSurface *surface)
|
||||
{
|
||||
@@ -1338,6 +1301,35 @@ gdk_surface_x11_withdraw (GdkSurface *surface)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_x11_hide (GdkSurface *surface)
|
||||
{
|
||||
/* We'll get the unmap notify eventually, and handle it then,
|
||||
* but checking here makes things more consistent if we are
|
||||
* just doing stuff ourself.
|
||||
*/
|
||||
_gdk_x11_surface_grab_check_unmap (surface,
|
||||
NextRequest (GDK_SURFACE_XDISPLAY (surface)));
|
||||
|
||||
/* You can't simply unmap toplevel surfaces. */
|
||||
switch (surface->surface_type)
|
||||
{
|
||||
case GDK_SURFACE_TOPLEVEL:
|
||||
case GDK_SURFACE_TEMP: /* ? */
|
||||
gdk_surface_x11_withdraw (surface);
|
||||
return;
|
||||
|
||||
case GDK_SURFACE_CHILD:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_gdk_surface_clear_update_area (surface);
|
||||
|
||||
XUnmapWindow (GDK_SURFACE_XDISPLAY (surface),
|
||||
GDK_SURFACE_XID (surface));
|
||||
}
|
||||
|
||||
static inline void
|
||||
surface_x11_move (GdkSurface *surface,
|
||||
gint x,
|
||||
|
||||
@@ -27,7 +27,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceManagerCore, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceManagerXI2, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DeviceXI2, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Display, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11DragContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Drag, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11GLContext, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Keymap, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkX11Screen, g_object_unref)
|
||||
|
||||
+11
-11
@@ -26,23 +26,23 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_X11_DRAG_CONTEXT (gdk_x11_drag_context_get_type ())
|
||||
#define GDK_X11_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContext))
|
||||
#define GDK_X11_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContextClass))
|
||||
#define GDK_IS_X11_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_DRAG_CONTEXT))
|
||||
#define GDK_IS_X11_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_DRAG_CONTEXT))
|
||||
#define GDK_X11_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_DRAG_CONTEXT, GdkX11DragContextClass))
|
||||
#define GDK_TYPE_X11_DRAG (gdk_x11_drag_get_type ())
|
||||
#define GDK_X11_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_X11_DRAG, GdkX11Drag))
|
||||
#define GDK_X11_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_X11_DRAG, GdkX11DragClass))
|
||||
#define GDK_IS_X11_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_X11_DRAG))
|
||||
#define GDK_IS_X11_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_X11_DRAG))
|
||||
#define GDK_X11_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_X11_DRAG, GdkX11DragClass))
|
||||
|
||||
#ifdef GDK_COMPILATION
|
||||
typedef struct _GdkX11DragContext GdkX11DragContext;
|
||||
typedef struct _GdkX11Drag GdkX11Drag;
|
||||
#else
|
||||
typedef GdkDragContext GdkX11DragContext;
|
||||
typedef GdkDrag GdkX11Drag;
|
||||
#endif
|
||||
typedef struct _GdkX11DragContextClass GdkX11DragContextClass;
|
||||
typedef struct _GdkX11DragClass GdkX11DragClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_x11_drag_context_get_type (void);
|
||||
GType gdk_x11_drag_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X11_DRAG_CONTEXT_H__ */
|
||||
#endif /* __GDK_X11_DRAG_H__ */
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ gdk_x11_sources = files([
|
||||
'gdkdevicemanager-x11.c',
|
||||
'gdkdevicemanager-xi2.c',
|
||||
'gdkdisplay-x11.c',
|
||||
'gdkdnd-x11.c',
|
||||
'gdkdrag-x11.c',
|
||||
'gdkdrop-x11.c',
|
||||
'gdkeventsource.c',
|
||||
'gdkeventtranslator.c',
|
||||
@@ -70,7 +70,7 @@ gdk_x11_deps = [
|
||||
xinerama_dep,
|
||||
]
|
||||
|
||||
libgdk_x11 = static_library('gdk-x11',
|
||||
libgdk_x11 = static_library('gdk-x11', gdkmarshal_h,
|
||||
gdk_x11_sources, gdkconfig, gdkenum_h,
|
||||
include_directories: [ confinc, gdkinc, ],
|
||||
c_args: [
|
||||
|
||||
+97
-71
@@ -13,6 +13,7 @@
|
||||
#include "gskglglyphcacheprivate.h"
|
||||
#include "gskglrenderopsprivate.h"
|
||||
#include "gskcairoblurprivate.h"
|
||||
#include "gskglshadowcacheprivate.h"
|
||||
|
||||
#include "gskprivate.h"
|
||||
|
||||
@@ -53,7 +54,6 @@
|
||||
glGetUniformLocation(program_ptr->id, "u_" #uniform_basename);\
|
||||
}G_STMT_END
|
||||
|
||||
|
||||
static void G_GNUC_UNUSED
|
||||
print_render_node_tree (GskRenderNode *root, int level)
|
||||
{
|
||||
@@ -266,6 +266,7 @@ struct _GskGLRenderer
|
||||
GArray *render_ops;
|
||||
|
||||
GskGLGlyphCache glyph_cache;
|
||||
GskGLShadowCache shadow_cache;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
struct {
|
||||
@@ -321,13 +322,19 @@ render_fallback_node (GskGLRenderer *self,
|
||||
const GskQuadVertex *vertex_data)
|
||||
{
|
||||
const float scale = ops_get_scale (builder);
|
||||
const int surface_width = ceilf (node->bounds.size.width) * scale;
|
||||
const int surface_height = ceilf (node->bounds.size.height) * scale;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
int texture_id;
|
||||
|
||||
if (surface_width <= 0 ||
|
||||
surface_height <= 0)
|
||||
return;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
ceilf (node->bounds.size.width) * scale,
|
||||
ceilf (node->bounds.size.height) * scale);
|
||||
surface_width,
|
||||
surface_height);
|
||||
cairo_surface_set_device_scale (surface, scale, scale);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
@@ -349,8 +356,8 @@ render_fallback_node (GskGLRenderer *self,
|
||||
|
||||
/* Upload the Cairo surface to a GL texture */
|
||||
texture_id = gsk_gl_driver_create_texture (self->gl_driver,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface));
|
||||
surface_width,
|
||||
surface_height);
|
||||
|
||||
gsk_gl_driver_bind_source_texture (self->gl_driver, texture_id);
|
||||
gsk_gl_driver_init_texture_with_surface (self->gl_driver,
|
||||
@@ -378,8 +385,8 @@ render_text_node (GskGLRenderer *self,
|
||||
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
|
||||
int i;
|
||||
int x_position = 0;
|
||||
int x = gsk_text_node_get_x (node) + builder->dx;
|
||||
int y = gsk_text_node_get_y (node) + builder->dy;
|
||||
float x = gsk_text_node_get_x (node) + builder->dx;
|
||||
float y = gsk_text_node_get_y (node) + builder->dy;
|
||||
|
||||
/* If the font has color glyphs, we don't need to recolor anything */
|
||||
if (!force_color && font_has_color_glyphs (font))
|
||||
@@ -398,7 +405,7 @@ render_text_node (GskGLRenderer *self,
|
||||
{
|
||||
const PangoGlyphInfo *gi = &glyphs[i];
|
||||
const GskGLCachedGlyph *glyph;
|
||||
int glyph_x, glyph_y, glyph_w, glyph_h;
|
||||
float glyph_x, glyph_y, glyph_w, glyph_h;
|
||||
float tx, ty, tx2, ty2;
|
||||
double cx;
|
||||
double cy;
|
||||
@@ -1067,10 +1074,8 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
graphene_matrix_t prev_modelview;
|
||||
graphene_rect_t prev_viewport;
|
||||
graphene_matrix_t item_proj;
|
||||
GskRoundedRect prev_clip, blit_clip;
|
||||
int prev_render_target;
|
||||
int texture_id, render_target;
|
||||
int blurred_texture_id, blurred_render_target;
|
||||
int blurred_texture_id;
|
||||
int cached_tid;
|
||||
|
||||
/* offset_outline is the minimal outline we need to draw the given drop shadow,
|
||||
* enlarged by the spread and offset by the blur radius. */
|
||||
@@ -1092,77 +1097,97 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
texture_width = offset_outline.bounds.size.width + blur_extra;
|
||||
texture_height = offset_outline.bounds.size.height + blur_extra;
|
||||
|
||||
texture_id = gsk_gl_driver_create_texture (self->gl_driver, texture_width, texture_height);
|
||||
gsk_gl_driver_bind_source_texture (self->gl_driver, texture_id);
|
||||
gsk_gl_driver_init_texture_empty (self->gl_driver, texture_id);
|
||||
render_target = gsk_gl_driver_create_render_target (self->gl_driver, texture_id, FALSE, FALSE);
|
||||
cached_tid = gsk_gl_shadow_cache_get_texture_id (&self->shadow_cache,
|
||||
self->gl_driver,
|
||||
&offset_outline,
|
||||
blur_radius);
|
||||
if (cached_tid == 0)
|
||||
{
|
||||
int texture_id, render_target;
|
||||
int blurred_render_target;
|
||||
int prev_render_target;
|
||||
GskRoundedRect prev_clip, blit_clip;
|
||||
|
||||
texture_id = gsk_gl_driver_create_texture (self->gl_driver, texture_width, texture_height);
|
||||
gsk_gl_driver_bind_source_texture (self->gl_driver, texture_id);
|
||||
gsk_gl_driver_init_texture_empty (self->gl_driver, texture_id);
|
||||
render_target = gsk_gl_driver_create_render_target (self->gl_driver, texture_id, FALSE, FALSE);
|
||||
|
||||
|
||||
graphene_matrix_init_ortho (&item_proj,
|
||||
0, texture_width, 0, texture_height,
|
||||
ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
|
||||
graphene_matrix_scale (&item_proj, 1, -1, 1);
|
||||
graphene_matrix_init_identity (&identity);
|
||||
graphene_matrix_init_ortho (&item_proj,
|
||||
0, texture_width, 0, texture_height,
|
||||
ORTHO_NEAR_PLANE, ORTHO_FAR_PLANE);
|
||||
graphene_matrix_scale (&item_proj, 1, -1, 1);
|
||||
graphene_matrix_init_identity (&identity);
|
||||
|
||||
prev_render_target = ops_set_render_target (builder, render_target);
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
prev_modelview = ops_set_modelview (builder, &identity);
|
||||
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
|
||||
prev_render_target = ops_set_render_target (builder, render_target);
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
prev_modelview = ops_set_modelview (builder, &identity);
|
||||
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
|
||||
|
||||
/* Draw outline */
|
||||
ops_set_program (builder, &self->color_program);
|
||||
prev_clip = ops_set_clip (builder, &offset_outline);
|
||||
ops_set_color (builder, gsk_outset_shadow_node_peek_color (node));
|
||||
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
|
||||
{ { 0, }, { 0, 1 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, }, { 1, 1 }, },
|
||||
/* Draw outline */
|
||||
ops_set_program (builder, &self->color_program);
|
||||
prev_clip = ops_set_clip (builder, &offset_outline);
|
||||
ops_set_color (builder, gsk_outset_shadow_node_peek_color (node));
|
||||
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
|
||||
{ { 0, }, { 0, 1 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, }, { 1, 1 }, },
|
||||
|
||||
{ { texture_width, texture_height }, { 1, 0 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, }, { 1, 1 }, },
|
||||
});
|
||||
{ { texture_width, texture_height }, { 1, 0 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, }, { 1, 1 }, },
|
||||
});
|
||||
|
||||
blurred_texture_id = gsk_gl_driver_create_texture (self->gl_driver, texture_width, texture_height);
|
||||
gsk_gl_driver_bind_source_texture (self->gl_driver, blurred_texture_id);
|
||||
gsk_gl_driver_init_texture_empty (self->gl_driver, blurred_texture_id);
|
||||
blurred_render_target = gsk_gl_driver_create_render_target (self->gl_driver, blurred_texture_id, TRUE, TRUE);
|
||||
blurred_texture_id = gsk_gl_driver_create_permanent_texture (self->gl_driver, texture_width, texture_height);
|
||||
gsk_gl_driver_bind_source_texture (self->gl_driver, blurred_texture_id);
|
||||
gsk_gl_driver_init_texture_empty (self->gl_driver, blurred_texture_id);
|
||||
blurred_render_target = gsk_gl_driver_create_render_target (self->gl_driver, blurred_texture_id, TRUE, TRUE);
|
||||
|
||||
ops_set_render_target (builder, blurred_render_target);
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
ops_set_render_target (builder, blurred_render_target);
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
|
||||
gsk_rounded_rect_init_from_rect (&blit_clip,
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height), 0.0f);
|
||||
gsk_rounded_rect_init_from_rect (&blit_clip,
|
||||
&GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height), 0.0f);
|
||||
|
||||
ops_set_program (builder, &self->blur_program);
|
||||
op.op = OP_CHANGE_BLUR;
|
||||
op.blur.size.width = texture_width;
|
||||
op.blur.size.height = texture_height;
|
||||
op.blur.radius = blur_radius;
|
||||
ops_add (builder, &op);
|
||||
ops_set_program (builder, &self->blur_program);
|
||||
op.op = OP_CHANGE_BLUR;
|
||||
op.blur.size.width = texture_width;
|
||||
op.blur.size.height = texture_height;
|
||||
op.blur.radius = blur_radius;
|
||||
ops_add (builder, &op);
|
||||
|
||||
ops_set_clip (builder, &blit_clip);
|
||||
ops_set_texture (builder, texture_id);
|
||||
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
|
||||
{ { 0, 0 }, { 0, 1 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, 0 }, { 1, 1 }, },
|
||||
ops_set_clip (builder, &blit_clip);
|
||||
ops_set_texture (builder, texture_id);
|
||||
ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
|
||||
{ { 0, 0 }, { 0, 1 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, 0 }, { 1, 1 }, },
|
||||
|
||||
{ { texture_width, texture_height }, { 1, 0 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, 0 }, { 1, 1 }, },
|
||||
});
|
||||
{ { texture_width, texture_height }, { 1, 0 }, },
|
||||
{ { 0, texture_height }, { 0, 0 }, },
|
||||
{ { texture_width, 0 }, { 1, 1 }, },
|
||||
});
|
||||
|
||||
|
||||
ops_set_clip (builder, &prev_clip);
|
||||
ops_set_clip (builder, &prev_clip);
|
||||
ops_set_viewport (builder, &prev_viewport);
|
||||
ops_set_modelview (builder, &prev_modelview);
|
||||
ops_set_projection (builder, &prev_projection);
|
||||
ops_set_render_target (builder, prev_render_target);
|
||||
|
||||
ops_set_viewport (builder, &prev_viewport);
|
||||
ops_set_modelview (builder, &prev_modelview);
|
||||
ops_set_projection (builder, &prev_projection);
|
||||
ops_set_render_target (builder, prev_render_target);
|
||||
gsk_gl_shadow_cache_commit (&self->shadow_cache,
|
||||
&offset_outline,
|
||||
blur_radius,
|
||||
blurred_texture_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
blurred_texture_id = cached_tid;
|
||||
}
|
||||
|
||||
ops_set_program (builder, &self->outset_shadow_program);
|
||||
ops_set_texture (builder, blurred_texture_id);
|
||||
@@ -1387,8 +1412,6 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ops_set_clip (builder, &prev_clip);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -2000,6 +2023,7 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
return FALSE;
|
||||
|
||||
gsk_gl_glyph_cache_init (&self->glyph_cache, renderer, self->gl_driver);
|
||||
gsk_gl_shadow_cache_init (&self->shadow_cache);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2024,6 +2048,7 @@ gsk_gl_renderer_unrealize (GskRenderer *renderer)
|
||||
glDeleteProgram (self->programs[i].id);
|
||||
|
||||
gsk_gl_glyph_cache_free (&self->glyph_cache);
|
||||
gsk_gl_shadow_cache_free (&self->shadow_cache, self->gl_driver);
|
||||
|
||||
g_clear_object (&self->gl_profiler);
|
||||
g_clear_object (&self->gl_driver);
|
||||
@@ -2518,6 +2543,7 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
|
||||
|
||||
gsk_gl_driver_begin_frame (self->gl_driver);
|
||||
gsk_gl_glyph_cache_begin_frame (&self->glyph_cache);
|
||||
gsk_gl_shadow_cache_begin_frame (&self->shadow_cache, self->gl_driver);
|
||||
|
||||
memset (&render_op_builder, 0, sizeof (render_op_builder));
|
||||
render_op_builder.renderer = self;
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
|
||||
#include "gskglshadowcacheprivate.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskRoundedRect outline;
|
||||
float blur_radius;
|
||||
} CacheKey;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskRoundedRect outline;
|
||||
float blur_radius;
|
||||
|
||||
int texture_id;
|
||||
guint used : 1;
|
||||
} CacheItem;
|
||||
|
||||
static gboolean
|
||||
key_equal (const void *x,
|
||||
const void *y)
|
||||
{
|
||||
const CacheKey *a = x;
|
||||
const CacheKey *b = y;
|
||||
|
||||
return graphene_size_equal (&a->outline.corner[0], &b->outline.corner[0]) &&
|
||||
graphene_size_equal (&a->outline.corner[1], &b->outline.corner[1]) &&
|
||||
graphene_size_equal (&a->outline.corner[2], &b->outline.corner[2]) &&
|
||||
graphene_size_equal (&a->outline.corner[3], &b->outline.corner[3]) &&
|
||||
graphene_rect_equal (&a->outline.bounds, &b->outline.bounds) &&
|
||||
a->blur_radius == b->blur_radius;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_shadow_cache_init (GskGLShadowCache *self)
|
||||
{
|
||||
self->textures = g_array_new (FALSE, TRUE, sizeof (CacheItem));
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_shadow_cache_free (GskGLShadowCache *self,
|
||||
GskGLDriver *gl_driver)
|
||||
{
|
||||
guint i, p;
|
||||
|
||||
for (i = 0, p = self->textures->len; i < p; i ++)
|
||||
{
|
||||
const CacheItem *item = &g_array_index (self->textures, CacheItem, i);
|
||||
|
||||
gsk_gl_driver_destroy_texture (gl_driver, item->texture_id);
|
||||
}
|
||||
|
||||
g_array_free (self->textures, TRUE);
|
||||
self->textures = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_shadow_cache_begin_frame (GskGLShadowCache *self,
|
||||
GskGLDriver *gl_driver)
|
||||
{
|
||||
guint i, p;
|
||||
|
||||
/* We remove all textures with used = FALSE since those have not been used in the
|
||||
* last frame. For all others, we reset the `used` value to FALSE instead and see
|
||||
* if they end up with TRUE in the next call to begin_frame. */
|
||||
for (i = 0, p = self->textures->len; i < p; i ++)
|
||||
{
|
||||
CacheItem *item = &g_array_index (self->textures, CacheItem, i);
|
||||
|
||||
if (!item->used)
|
||||
{
|
||||
gsk_gl_driver_destroy_texture (gl_driver, item->texture_id);
|
||||
g_array_remove_index_fast (self->textures, i);
|
||||
p --;
|
||||
i --;
|
||||
}
|
||||
else
|
||||
{
|
||||
item->used = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX
|
||||
* The offset origin should always be at 0/0, or the blur radius should just go
|
||||
* away since it defines the origin position anyway?
|
||||
*/
|
||||
int
|
||||
gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
|
||||
GskGLDriver *gl_driver,
|
||||
const GskRoundedRect *shadow_rect,
|
||||
float blur_radius)
|
||||
{
|
||||
CacheItem *item= NULL;
|
||||
guint i;
|
||||
|
||||
g_assert (self != NULL);
|
||||
g_assert (gl_driver != NULL);
|
||||
g_assert (shadow_rect != NULL);
|
||||
|
||||
for (i = 0; i < self->textures->len; i ++)
|
||||
{
|
||||
CacheItem *k = &g_array_index (self->textures, CacheItem, i);
|
||||
|
||||
if (key_equal (&(CacheKey){*shadow_rect, blur_radius},
|
||||
&(CacheKey){k->outline, k->blur_radius}))
|
||||
{
|
||||
item = k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (item == NULL)
|
||||
return 0;
|
||||
|
||||
item->used = TRUE;
|
||||
|
||||
g_assert (item->texture_id != 0);
|
||||
|
||||
return item->texture_id;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_gl_shadow_cache_commit (GskGLShadowCache *self,
|
||||
const GskRoundedRect *shadow_rect,
|
||||
float blur_radius,
|
||||
int texture_id)
|
||||
{
|
||||
CacheItem *item;
|
||||
|
||||
g_assert (self != NULL);
|
||||
g_assert (shadow_rect != NULL);
|
||||
g_assert (texture_id > 0);
|
||||
|
||||
g_array_set_size (self->textures, self->textures->len + 1);
|
||||
item = &g_array_index (self->textures, CacheItem, self->textures->len - 1);
|
||||
|
||||
item->outline = *shadow_rect;
|
||||
item->blur_radius = blur_radius;
|
||||
item->used = TRUE;
|
||||
item->texture_id = texture_id;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
#ifndef __GSK_GL_SHADOW_CACHE_H__
|
||||
#define __GSK_GL_SHADOW_CACHE_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "gskgldriverprivate.h"
|
||||
#include "gskroundedrect.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GArray *textures;
|
||||
} GskGLShadowCache;
|
||||
|
||||
|
||||
void gsk_gl_shadow_cache_init (GskGLShadowCache *self);
|
||||
void gsk_gl_shadow_cache_free (GskGLShadowCache *self,
|
||||
GskGLDriver *gl_driver);
|
||||
void gsk_gl_shadow_cache_begin_frame (GskGLShadowCache *self,
|
||||
GskGLDriver *gl_driver);
|
||||
int gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
|
||||
GskGLDriver *gl_driver,
|
||||
const GskRoundedRect *shadow_rect,
|
||||
float blur_radius);
|
||||
void gsk_gl_shadow_cache_commit (GskGLShadowCache *self,
|
||||
const GskRoundedRect *shadow_rect,
|
||||
float blur_radius,
|
||||
int texture_id);
|
||||
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -448,8 +448,8 @@ gsk_renderer_render_texture (GskRenderer *renderer,
|
||||
* gsk_renderer_render:
|
||||
* @renderer: a #GskRenderer
|
||||
* @root: a #GskRenderNode
|
||||
* @region: the #cairo_region_t that must be redrawn or %NULL for the whole
|
||||
* window
|
||||
* @region: (nullable): the #cairo_region_t that must be redrawn or %NULL
|
||||
* for the whole window
|
||||
*
|
||||
* Renders the scene graph, described by a tree of #GskRenderNode instances,
|
||||
* ensuring that the given @region gets redrawn.
|
||||
|
||||
+4
-4
@@ -205,14 +205,14 @@ const graphene_matrix_t *
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gsk_offset_node_new (GskRenderNode *child,
|
||||
double x_offset,
|
||||
double y_offset);
|
||||
float x_offset,
|
||||
float y_offset);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gsk_offset_node_get_child (GskRenderNode *node);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
double gsk_offset_node_get_x_offset (GskRenderNode *node);
|
||||
float gsk_offset_node_get_x_offset (GskRenderNode *node);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
double gsk_offset_node_get_y_offset (GskRenderNode *node);
|
||||
float gsk_offset_node_get_y_offset (GskRenderNode *node);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gsk_opacity_node_new (GskRenderNode *child,
|
||||
|
||||
+20
-14
@@ -2561,8 +2561,8 @@ struct _GskOffsetNode
|
||||
GskRenderNode render_node;
|
||||
|
||||
GskRenderNode *child;
|
||||
double x_offset;
|
||||
double y_offset;
|
||||
float x_offset;
|
||||
float y_offset;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -2694,8 +2694,8 @@ static const GskRenderNodeClass GSK_OFFSET_NODE_CLASS = {
|
||||
*/
|
||||
GskRenderNode *
|
||||
gsk_offset_node_new (GskRenderNode *child,
|
||||
double x_offset,
|
||||
double y_offset)
|
||||
float x_offset,
|
||||
float y_offset)
|
||||
{
|
||||
GskOffsetNode *self;
|
||||
|
||||
@@ -2732,7 +2732,7 @@ gsk_offset_node_get_child (GskRenderNode *node)
|
||||
return self->child;
|
||||
}
|
||||
|
||||
double
|
||||
float
|
||||
gsk_offset_node_get_x_offset (GskRenderNode *node)
|
||||
{
|
||||
GskOffsetNode *self = (GskOffsetNode *) node;
|
||||
@@ -2742,7 +2742,7 @@ gsk_offset_node_get_x_offset (GskRenderNode *node)
|
||||
return self->x_offset;
|
||||
}
|
||||
|
||||
double
|
||||
float
|
||||
gsk_offset_node_get_y_offset (GskRenderNode *node)
|
||||
{
|
||||
GskOffsetNode *self = (GskOffsetNode *) node;
|
||||
@@ -3565,7 +3565,7 @@ gsk_clip_node_diff (GskRenderNode *node1,
|
||||
{
|
||||
cairo_region_t *sub;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
|
||||
|
||||
sub = cairo_region_create();
|
||||
gsk_render_node_diff (self1->child, self2->child, sub);
|
||||
rectangle_init_from_graphene (&clip_rect, &self1->clip);
|
||||
@@ -3573,8 +3573,10 @@ gsk_clip_node_diff (GskRenderNode *node1,
|
||||
cairo_region_union (region, sub);
|
||||
cairo_region_destroy (sub);
|
||||
}
|
||||
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
else
|
||||
{
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
}
|
||||
}
|
||||
|
||||
#define GSK_CLIP_NODE_VARIANT_TYPE "(dddduv)"
|
||||
@@ -3737,7 +3739,7 @@ gsk_rounded_clip_node_diff (GskRenderNode *node1,
|
||||
{
|
||||
cairo_region_t *sub;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
|
||||
|
||||
sub = cairo_region_create();
|
||||
gsk_render_node_diff (self1->child, self2->child, sub);
|
||||
rectangle_init_from_graphene (&clip_rect, &self1->clip.bounds);
|
||||
@@ -3745,8 +3747,10 @@ gsk_rounded_clip_node_diff (GskRenderNode *node1,
|
||||
cairo_region_union (region, sub);
|
||||
cairo_region_destroy (sub);
|
||||
}
|
||||
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
else
|
||||
{
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
}
|
||||
}
|
||||
|
||||
#define GSK_ROUNDED_CLIP_NODE_VARIANT_TYPE "(dddddddddddduv)"
|
||||
@@ -4262,8 +4266,10 @@ gsk_blend_node_diff (GskRenderNode *node1,
|
||||
gsk_render_node_diff (self1->top, self2->top, region);
|
||||
gsk_render_node_diff (self1->bottom, self2->bottom, region);
|
||||
}
|
||||
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
else
|
||||
{
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
}
|
||||
}
|
||||
|
||||
#define GSK_BLEND_NODE_VARIANT_TYPE "(uvuvu)"
|
||||
|
||||
@@ -50,7 +50,7 @@ G_BEGIN_DECLS
|
||||
* @bounds: the bounds of the rectangle
|
||||
* @corner: the size of the 4 rounded corners
|
||||
*
|
||||
* A rectanglular region with rounded corners.
|
||||
* A rectangular region with rounded corners.
|
||||
*
|
||||
* Application code should normalize rectangles using gsk_rounded_rect_normalize();
|
||||
* this function will ensure that the bounds of the rectanlge are normalized
|
||||
|
||||
+2
-1
@@ -41,7 +41,8 @@ gsk_private_sources = files([
|
||||
'gl/gskglglyphcache.c',
|
||||
'gl/gskglimage.c',
|
||||
'gl/gskgldriver.c',
|
||||
'gl/gskglrenderops.c'
|
||||
'gl/gskglrenderops.c',
|
||||
'gl/gskglshadowcache.c',
|
||||
])
|
||||
|
||||
gsk_public_headers = files([
|
||||
|
||||
@@ -1,15 +1,102 @@
|
||||
uniform mat4 uMVP;
|
||||
uniform sampler2D uSource;
|
||||
uniform sampler2D uMask;
|
||||
uniform float uAlpha;
|
||||
uniform sampler2D u_source;
|
||||
uniform sampler2D u_mask;
|
||||
uniform mat4 u_projection;
|
||||
uniform mat4 u_modelview;
|
||||
uniform float u_alpha;
|
||||
uniform int uBlendMode;
|
||||
uniform vec4 u_viewport;
|
||||
|
||||
// In GtkSnapshot coordinates
|
||||
uniform vec4 u_clip;
|
||||
uniform vec4 u_clip_corner_widths;
|
||||
uniform vec4 u_clip_corner_heights;
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
|
||||
struct RoundedRect
|
||||
{
|
||||
vec4 bounds;
|
||||
vec4 corner_widths;
|
||||
vec4 corner_heights;
|
||||
};
|
||||
|
||||
float
|
||||
ellipsis_dist (vec2 p, vec2 radius)
|
||||
{
|
||||
if (radius == vec2(0, 0))
|
||||
return 0.0;
|
||||
|
||||
vec2 p0 = p / radius;
|
||||
vec2 p1 = 2.0 * p0 / radius;
|
||||
|
||||
return (dot(p0, p0) - 1.0) / length (p1);
|
||||
}
|
||||
|
||||
float
|
||||
ellipsis_coverage (vec2 point, vec2 center, vec2 radius)
|
||||
{
|
||||
float d = ellipsis_dist (point - center, radius);
|
||||
return clamp (0.5 - d, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float
|
||||
rounded_rect_coverage (RoundedRect r, vec2 p)
|
||||
{
|
||||
if (p.x < r.bounds.x || p.y < r.bounds.y ||
|
||||
p.x >= r.bounds.z || p.y >= r.bounds.w)
|
||||
return 0.0;
|
||||
|
||||
vec2 rad_tl = vec2(r.corner_widths.x, r.corner_heights.x);
|
||||
vec2 rad_tr = vec2(r.corner_widths.y, r.corner_heights.y);
|
||||
vec2 rad_br = vec2(r.corner_widths.z, r.corner_heights.z);
|
||||
vec2 rad_bl = vec2(r.corner_widths.w, r.corner_heights.w);
|
||||
|
||||
vec2 ref_tl = r.bounds.xy + vec2( r.corner_widths.x, r.corner_heights.x);
|
||||
vec2 ref_tr = r.bounds.zy + vec2(-r.corner_widths.y, r.corner_heights.y);
|
||||
vec2 ref_br = r.bounds.zw + vec2(-r.corner_widths.z, -r.corner_heights.z);
|
||||
vec2 ref_bl = r.bounds.xw + vec2( r.corner_widths.w, -r.corner_heights.w);
|
||||
|
||||
float d_tl = ellipsis_coverage(p, ref_tl, rad_tl);
|
||||
float d_tr = ellipsis_coverage(p, ref_tr, rad_tr);
|
||||
float d_br = ellipsis_coverage(p, ref_br, rad_br);
|
||||
float d_bl = ellipsis_coverage(p, ref_bl, rad_bl);
|
||||
|
||||
vec4 corner_coverages = 1.0 - vec4(d_tl, d_tr, d_br, d_bl);
|
||||
|
||||
bvec4 is_out = bvec4(p.x < ref_tl.x && p.y < ref_tl.y,
|
||||
p.x > ref_tr.x && p.y < ref_tr.y,
|
||||
p.x > ref_br.x && p.y > ref_br.y,
|
||||
p.x < ref_bl.x && p.y > ref_bl.y);
|
||||
|
||||
return 1.0 - dot(vec4(is_out), corner_coverages);
|
||||
}
|
||||
|
||||
RoundedRect
|
||||
rounded_rect_shrink (RoundedRect r, vec4 amount)
|
||||
{
|
||||
vec4 new_bounds = r.bounds + vec4(1.0,1.0,-1.0,-1.0) * amount.wxyz;
|
||||
vec4 new_widths = max (r.corner_widths - amount.wyyw, 0.0);
|
||||
vec4 new_heights = max (r.corner_heights - amount.xxzz, 0.0);
|
||||
|
||||
return RoundedRect (new_bounds, new_widths, new_heights);
|
||||
}
|
||||
|
||||
vec4 Texture(sampler2D sampler, vec2 texCoords) {
|
||||
return texture2D(sampler, texCoords);
|
||||
}
|
||||
|
||||
void setOutputColor(vec4 color) {
|
||||
gl_FragColor = color;
|
||||
vec4 clipBounds = u_clip;
|
||||
vec4 f = gl_FragCoord;
|
||||
|
||||
f.x += u_viewport.x;
|
||||
f.y = (u_viewport.y + u_viewport.w) - f.y;
|
||||
|
||||
clipBounds.z = clipBounds.x + clipBounds.z;
|
||||
clipBounds.w = clipBounds.y + clipBounds.w;
|
||||
|
||||
RoundedRect r = RoundedRect(clipBounds, u_clip_corner_widths, u_clip_corner_heights);
|
||||
|
||||
gl_FragColor = color * rounded_rect_coverage(r, f.xy);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
uniform mat4 uMVP;
|
||||
uniform mat4 u_projection;
|
||||
uniform mat4 u_modelview;
|
||||
|
||||
attribute vec2 aPosition;
|
||||
attribute vec2 aUv;
|
||||
|
||||
@@ -147,7 +147,7 @@ gsk_vulkan_renderer_unrealize (GskRenderer *renderer)
|
||||
data->renderer = NULL;
|
||||
gdk_texture_clear_render_data (data->texture);
|
||||
}
|
||||
g_clear_pointer (&self->textures, (GDestroyNotify) g_slist_free);
|
||||
g_clear_pointer (&self->textures, g_slist_free);
|
||||
|
||||
g_clear_pointer (&self->render, gsk_vulkan_render_free);
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 201 B |
Binary file not shown.
|
Before Width: | Height: | Size: 183 B |
Binary file not shown.
|
Before Width: | Height: | Size: 216 B |
Binary file not shown.
|
Before Width: | Height: | Size: 197 B |
Binary file not shown.
|
Before Width: | Height: | Size: 144 B |
@@ -51,11 +51,6 @@ xml += '''
|
||||
<file>theme/win32/gtk.css</file>
|
||||
'''
|
||||
|
||||
for f in get_files('cursor', '.png'):
|
||||
xml += ' <file>cursor/{0}</file>\n'.format(f)
|
||||
|
||||
xml += '\n'
|
||||
|
||||
for f in get_files('gesture', '.symbolic.png'):
|
||||
xml += ' <file alias=\'icons/64x64/actions/{0}\'>gesture/{0}</file>\n'.format(f)
|
||||
|
||||
@@ -66,8 +61,8 @@ for f in get_files('ui', '.ui'):
|
||||
|
||||
xml += '\n'
|
||||
|
||||
for s in ['16x16', '22x22', '24x24', '32x32', '48x48']:
|
||||
for c in ['actions', 'status']:
|
||||
for s in ['16x16', '24x24', '32x32', '48x48']:
|
||||
for c in ['categories', 'status']:
|
||||
icons_dir = 'icons/{0}/{1}'.format(s,c)
|
||||
if os.path.exists(os.path.join(srcdir,icons_dir)):
|
||||
for f in get_files(icons_dir, '.png'):
|
||||
|
||||
+4
-4
@@ -127,10 +127,10 @@ gsk_pango_renderer_show_text_glyphs (PangoRenderer *renderer,
|
||||
return;
|
||||
|
||||
graphene_rect_init (&node_bounds,
|
||||
(float)x/PANGO_SCALE,
|
||||
(float)y/PANGO_SCALE + ink_rect.y,
|
||||
ink_rect.x + ink_rect.width,
|
||||
ink_rect.height);
|
||||
(float)x/PANGO_SCALE - 1.0,
|
||||
(float)y/PANGO_SCALE + ink_rect.y - 1.0,
|
||||
ink_rect.x + ink_rect.width + 2.0,
|
||||
ink_rect.height + 2.0);
|
||||
|
||||
gtk_snapshot_get_offset (crenderer->snapshot, &x_offset, &y_offset);
|
||||
graphene_rect_offset (&node_bounds, x_offset, y_offset);
|
||||
|
||||
+83
-98
@@ -139,7 +139,7 @@ typedef struct
|
||||
gchar **people;
|
||||
} CreditSection;
|
||||
|
||||
struct _GtkAboutDialogPrivate
|
||||
typedef struct
|
||||
{
|
||||
gchar *name;
|
||||
gchar *version;
|
||||
@@ -191,7 +191,7 @@ struct _GtkAboutDialogPrivate
|
||||
guint wrap_license : 1;
|
||||
guint in_child_changed : 1;
|
||||
guint in_switch_page : 1;
|
||||
};
|
||||
} GtkAboutDialogPrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -274,7 +274,7 @@ stack_visible_child_notify (GtkStack *stack,
|
||||
GParamSpec *pspec,
|
||||
GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_stack_get_visible_child (stack);
|
||||
@@ -627,7 +627,7 @@ emit_activate_link (GtkAboutDialog *about,
|
||||
static void
|
||||
update_stack_switcher_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
if (gtk_widget_get_visible (priv->credits_page) ||
|
||||
gtk_widget_get_visible (priv->license_page) ||
|
||||
@@ -640,7 +640,7 @@ update_stack_switcher_visibility (GtkAboutDialog *about)
|
||||
static void
|
||||
update_license_button_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
if (priv->license_type == GTK_LICENSE_CUSTOM && priv->license != NULL && priv->license[0] != '\0')
|
||||
gtk_widget_show (priv->license_page);
|
||||
@@ -653,7 +653,7 @@ update_license_button_visibility (GtkAboutDialog *about)
|
||||
static void
|
||||
update_system_button_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
if (priv->system_information != NULL && priv->system_information[0] != '\0')
|
||||
gtk_widget_show (priv->system_page);
|
||||
@@ -666,7 +666,7 @@ update_system_button_visibility (GtkAboutDialog *about)
|
||||
static void
|
||||
update_credits_button_visibility (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gboolean show;
|
||||
|
||||
show = (priv->authors != NULL ||
|
||||
@@ -688,7 +688,7 @@ static void
|
||||
switch_page (GtkAboutDialog *about,
|
||||
const gchar *name)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (priv->stack), name);
|
||||
|
||||
@@ -705,7 +705,7 @@ switch_page (GtkAboutDialog *about,
|
||||
static void
|
||||
apply_use_header_bar (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gboolean use_header_bar;
|
||||
|
||||
g_object_get (about, "use-header-bar", &use_header_bar, NULL);
|
||||
@@ -740,12 +740,9 @@ apply_use_header_bar (GtkAboutDialog *about)
|
||||
static void
|
||||
gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
/* Data */
|
||||
priv = gtk_about_dialog_get_instance_private (about);
|
||||
about->priv = priv;
|
||||
|
||||
priv->name = NULL;
|
||||
priv->version = NULL;
|
||||
priv->copyright = NULL;
|
||||
@@ -791,7 +788,7 @@ static void
|
||||
gtk_about_dialog_finalize (GObject *object)
|
||||
{
|
||||
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_free (priv->name);
|
||||
g_free (priv->version);
|
||||
@@ -884,7 +881,7 @@ gtk_about_dialog_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -953,7 +950,7 @@ toggle_credits (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkAboutDialog *about = user_data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gboolean show_credits;
|
||||
|
||||
if (priv->in_switch_page)
|
||||
@@ -968,7 +965,7 @@ toggle_license (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkAboutDialog *about = user_data;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gboolean show_license;
|
||||
|
||||
if (priv->in_switch_page)
|
||||
@@ -1010,7 +1007,7 @@ gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
||||
static void
|
||||
update_website (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
gtk_widget_show (priv->website_label);
|
||||
|
||||
@@ -1065,19 +1062,19 @@ gtk_about_dialog_show (GtkWidget *widget)
|
||||
const gchar *
|
||||
gtk_about_dialog_get_program_name (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->name;
|
||||
return priv->name;
|
||||
}
|
||||
|
||||
static void
|
||||
update_name_version (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *title_string, *name_string;
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
title_string = g_strdup_printf (_("About %s"), priv->name);
|
||||
gtk_window_set_title (GTK_WINDOW (about), title_string);
|
||||
g_free (title_string);
|
||||
@@ -1108,13 +1105,11 @@ void
|
||||
gtk_about_dialog_set_program_name (GtkAboutDialog *about,
|
||||
const gchar *name)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->name;
|
||||
priv->name = g_strdup (name ? name : g_get_application_name ());
|
||||
g_free (tmp);
|
||||
@@ -1137,9 +1132,11 @@ gtk_about_dialog_set_program_name (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_version (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->version;
|
||||
return priv->version;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1153,13 +1150,11 @@ void
|
||||
gtk_about_dialog_set_version (GtkAboutDialog *about,
|
||||
const gchar *version)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->version;
|
||||
priv->version = g_strdup (version);
|
||||
g_free (tmp);
|
||||
@@ -1181,9 +1176,11 @@ gtk_about_dialog_set_version (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_copyright (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->copyright;
|
||||
return priv->copyright;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1198,13 +1195,11 @@ void
|
||||
gtk_about_dialog_set_copyright (GtkAboutDialog *about,
|
||||
const gchar *copyright)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *copyright_string, *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->copyright;
|
||||
priv->copyright = g_strdup (copyright);
|
||||
g_free (tmp);
|
||||
@@ -1236,9 +1231,11 @@ gtk_about_dialog_set_copyright (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_comments (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->comments;
|
||||
return priv->comments;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1253,13 +1250,11 @@ void
|
||||
gtk_about_dialog_set_comments (GtkAboutDialog *about,
|
||||
const gchar *comments)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->comments;
|
||||
if (comments)
|
||||
{
|
||||
@@ -1289,9 +1284,11 @@ gtk_about_dialog_set_comments (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_license (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->license;
|
||||
return priv->license;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1307,13 +1304,11 @@ void
|
||||
gtk_about_dialog_set_license (GtkAboutDialog *about,
|
||||
const gchar *license)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->license;
|
||||
if (license)
|
||||
{
|
||||
@@ -1346,9 +1341,11 @@ gtk_about_dialog_set_license (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_system_information (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->system_information;
|
||||
return priv->system_information;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1366,12 +1363,10 @@ void
|
||||
gtk_about_dialog_set_system_information (GtkAboutDialog *about,
|
||||
const gchar *system_information)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
g_free (priv->system_information);
|
||||
priv->system_information = g_strdup (system_information);
|
||||
update_system_button_visibility (about);
|
||||
@@ -1391,9 +1386,11 @@ gtk_about_dialog_set_system_information (GtkAboutDialog *about,
|
||||
gboolean
|
||||
gtk_about_dialog_get_wrap_license (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), FALSE);
|
||||
|
||||
return about->priv->wrap_license;
|
||||
return priv->wrap_license;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1408,12 +1405,10 @@ void
|
||||
gtk_about_dialog_set_wrap_license (GtkAboutDialog *about,
|
||||
gboolean wrap_license)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
wrap_license = wrap_license != FALSE;
|
||||
|
||||
if (priv->wrap_license != wrap_license)
|
||||
@@ -1436,9 +1431,11 @@ gtk_about_dialog_set_wrap_license (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_website (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->website_url;
|
||||
return priv->website_url;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1452,13 +1449,11 @@ void
|
||||
gtk_about_dialog_set_website (GtkAboutDialog *about,
|
||||
const gchar *website)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->website_url;
|
||||
priv->website_url = g_strdup (website);
|
||||
g_free (tmp);
|
||||
@@ -1480,9 +1475,11 @@ gtk_about_dialog_set_website (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_website_label (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->website_text;
|
||||
return priv->website_text;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1496,13 +1493,11 @@ void
|
||||
gtk_about_dialog_set_website_label (GtkAboutDialog *about,
|
||||
const gchar *website_label)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->website_text;
|
||||
priv->website_text = g_strdup (website_label);
|
||||
g_free (tmp);
|
||||
@@ -1526,9 +1521,11 @@ gtk_about_dialog_set_website_label (GtkAboutDialog *about,
|
||||
const gchar * const *
|
||||
gtk_about_dialog_get_authors (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return (const gchar * const *) about->priv->authors;
|
||||
return (const gchar * const *) priv->authors;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1543,13 +1540,11 @@ void
|
||||
gtk_about_dialog_set_authors (GtkAboutDialog *about,
|
||||
const gchar **authors)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar **tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->authors;
|
||||
priv->authors = g_strdupv ((gchar **)authors);
|
||||
g_strfreev (tmp);
|
||||
@@ -1573,9 +1568,11 @@ gtk_about_dialog_set_authors (GtkAboutDialog *about,
|
||||
const gchar * const *
|
||||
gtk_about_dialog_get_documenters (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return (const gchar * const *)about->priv->documenters;
|
||||
return (const gchar * const *)priv->documenters;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1590,13 +1587,11 @@ void
|
||||
gtk_about_dialog_set_documenters (GtkAboutDialog *about,
|
||||
const gchar **documenters)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar **tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->documenters;
|
||||
priv->documenters = g_strdupv ((gchar **)documenters);
|
||||
g_strfreev (tmp);
|
||||
@@ -1620,9 +1615,11 @@ gtk_about_dialog_set_documenters (GtkAboutDialog *about,
|
||||
const gchar * const *
|
||||
gtk_about_dialog_get_artists (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return (const gchar * const *)about->priv->artists;
|
||||
return (const gchar * const *)priv->artists;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1637,13 +1634,11 @@ void
|
||||
gtk_about_dialog_set_artists (GtkAboutDialog *about,
|
||||
const gchar **artists)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar **tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->artists;
|
||||
priv->artists = g_strdupv ((gchar **)artists);
|
||||
g_strfreev (tmp);
|
||||
@@ -1666,9 +1661,11 @@ gtk_about_dialog_set_artists (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_translator_credits (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
return about->priv->translator_credits;
|
||||
return priv->translator_credits;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1697,13 +1694,11 @@ void
|
||||
gtk_about_dialog_set_translator_credits (GtkAboutDialog *about,
|
||||
const gchar *translator_credits)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
tmp = priv->translator_credits;
|
||||
priv->translator_credits = g_strdup (translator_credits);
|
||||
g_free (tmp);
|
||||
@@ -1726,12 +1721,10 @@ gtk_about_dialog_set_translator_credits (GtkAboutDialog *about,
|
||||
GdkPaintable *
|
||||
gtk_about_dialog_get_logo (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) == GTK_IMAGE_PAINTABLE)
|
||||
return gtk_image_get_paintable (GTK_IMAGE (priv->logo_image));
|
||||
else
|
||||
@@ -1751,13 +1744,11 @@ void
|
||||
gtk_about_dialog_set_logo (GtkAboutDialog *about,
|
||||
GdkPaintable *logo)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
g_return_if_fail (logo == NULL || GDK_IS_TEXTURE (logo));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (about));
|
||||
|
||||
if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) == GTK_IMAGE_ICON_NAME)
|
||||
@@ -1796,12 +1787,10 @@ gtk_about_dialog_set_logo (GtkAboutDialog *about,
|
||||
const gchar *
|
||||
gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) != GTK_IMAGE_ICON_NAME)
|
||||
return NULL;
|
||||
|
||||
@@ -1821,13 +1810,11 @@ void
|
||||
gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about,
|
||||
const gchar *icon_name)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
GList *icons;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (about));
|
||||
|
||||
if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) == GTK_IMAGE_PAINTABLE)
|
||||
@@ -1884,8 +1871,8 @@ follow_if_link (GtkAboutDialog *about,
|
||||
GtkTextView *text_view,
|
||||
GtkTextIter *iter)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
GSList *tags = NULL, *tagp = NULL;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
gchar *uri = NULL;
|
||||
|
||||
tags = gtk_text_iter_get_tags (iter);
|
||||
@@ -1984,7 +1971,7 @@ set_cursor_if_appropriate (GtkAboutDialog *about,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
GSList *tags = NULL, *tagp = NULL;
|
||||
GtkTextIter iter;
|
||||
gboolean hovering_over_link = FALSE;
|
||||
@@ -2039,13 +2026,13 @@ static GtkTextBuffer *
|
||||
text_buffer_new (GtkAboutDialog *about,
|
||||
gchar **strings)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gchar **p;
|
||||
gchar *q0, *q1, *q2, *r1, *r2;
|
||||
GtkTextBuffer *buffer;
|
||||
GdkRGBA color;
|
||||
GdkRGBA link_color;
|
||||
GdkRGBA visited_link_color;
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
GtkTextTag *tag;
|
||||
GtkStateFlags state = gtk_widget_get_state_flags (GTK_WIDGET (about));
|
||||
@@ -2290,7 +2277,7 @@ add_credits_section (GtkAboutDialog *about,
|
||||
static void
|
||||
populate_credits_page (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
gint row;
|
||||
|
||||
row = 0;
|
||||
@@ -2330,7 +2317,7 @@ populate_credits_page (GtkAboutDialog *about)
|
||||
static void
|
||||
populate_license_page (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
GtkTextBuffer *buffer;
|
||||
gchar *strings[2];
|
||||
|
||||
@@ -2346,7 +2333,7 @@ populate_license_page (GtkAboutDialog *about)
|
||||
static void
|
||||
populate_system_page (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = about->priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
GtkTextBuffer *buffer;
|
||||
gchar *strings[2];
|
||||
|
||||
@@ -2454,14 +2441,12 @@ void
|
||||
gtk_about_dialog_set_license_type (GtkAboutDialog *about,
|
||||
GtkLicense license_type)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
g_return_if_fail (license_type >= GTK_LICENSE_UNKNOWN &&
|
||||
license_type <= GTK_LICENSE_AGPL_3_0_ONLY);
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
if (priv->license_type != license_type)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (about));
|
||||
@@ -2524,9 +2509,11 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about,
|
||||
GtkLicense
|
||||
gtk_about_dialog_get_license_type (GtkAboutDialog *about)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), GTK_LICENSE_UNKNOWN);
|
||||
|
||||
return about->priv->license_type;
|
||||
return priv->license_type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2542,15 +2529,13 @@ gtk_about_dialog_add_credit_section (GtkAboutDialog *about,
|
||||
const gchar *section_name,
|
||||
const gchar **people)
|
||||
{
|
||||
GtkAboutDialogPrivate *priv;
|
||||
GtkAboutDialogPrivate *priv = gtk_about_dialog_get_instance_private (about);
|
||||
CreditSection *new_entry;
|
||||
|
||||
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
||||
g_return_if_fail (section_name != NULL);
|
||||
g_return_if_fail (people != NULL);
|
||||
|
||||
priv = about->priv;
|
||||
|
||||
new_entry = g_slice_new (CreditSection);
|
||||
new_entry->heading = g_strdup ((gchar *)section_name);
|
||||
new_entry->people = g_strdupv ((gchar **)people);
|
||||
|
||||
@@ -40,7 +40,6 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkAboutDialog GtkAboutDialog;
|
||||
typedef struct _GtkAboutDialogClass GtkAboutDialogClass;
|
||||
typedef struct _GtkAboutDialogPrivate GtkAboutDialogPrivate;
|
||||
|
||||
/**
|
||||
* GtkLicense:
|
||||
@@ -98,9 +97,6 @@ typedef enum {
|
||||
struct _GtkAboutDialog
|
||||
{
|
||||
GtkDialog parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
GtkAboutDialogPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkAboutDialogClass
|
||||
|
||||
+21
-12
@@ -722,64 +722,71 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
||||
GString *gstring;
|
||||
gboolean seen_mod = FALSE;
|
||||
gunichar ch;
|
||||
|
||||
gstring = g_string_new ("");
|
||||
|
||||
|
||||
gstring = g_string_sized_new (10); /* ~len('backspace') */
|
||||
|
||||
if (accelerator_mods & GDK_SHIFT_MASK)
|
||||
{
|
||||
g_string_append (gstring, klass->mod_name_shift);
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_CONTROL_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_name_control);
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_MOD1_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_name_alt);
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_MOD2_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
g_string_append (gstring, "Mod2");
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_MOD3_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
g_string_append (gstring, "Mod3");
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_MOD4_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
g_string_append (gstring, "Mod4");
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_MOD5_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
g_string_append (gstring, "Mod5");
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_SUPER_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
* that use the super key. If the text on this key isn't typically
|
||||
@@ -789,10 +796,11 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
||||
g_string_append (gstring, C_("keyboard label", "Super"));
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_HYPER_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
* that use the hyper key. If the text on this key isn't typically
|
||||
@@ -802,10 +810,11 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
|
||||
g_string_append (gstring, C_("keyboard label", "Hyper"));
|
||||
seen_mod = TRUE;
|
||||
}
|
||||
|
||||
if (accelerator_mods & GDK_META_MASK)
|
||||
{
|
||||
if (seen_mod)
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
g_string_append (gstring, klass->mod_separator);
|
||||
|
||||
#ifndef GDK_WINDOWING_QUARTZ
|
||||
/* This is the text that should appear next to menu accelerators
|
||||
|
||||
+122
-72
@@ -145,7 +145,7 @@ enum {
|
||||
|
||||
static GParamSpec *gtk_application_props[NUM_PROPERTIES];
|
||||
|
||||
struct _GtkApplicationPrivate
|
||||
typedef struct
|
||||
{
|
||||
GtkApplicationImpl *impl;
|
||||
GtkApplicationAccels *accels;
|
||||
@@ -160,7 +160,7 @@ struct _GtkApplicationPrivate
|
||||
GtkActionMuxer *muxer;
|
||||
GtkBuilder *menus_builder;
|
||||
gchar *help_overlay_path;
|
||||
};
|
||||
} GtkApplicationPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkApplication, gtk_application, G_TYPE_APPLICATION)
|
||||
|
||||
@@ -169,7 +169,7 @@ gtk_application_window_active_cb (GtkWindow *window,
|
||||
GParamSpec *pspec,
|
||||
GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = application->priv;
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GList *link;
|
||||
|
||||
if (!gtk_window_is_active (window))
|
||||
@@ -183,8 +183,8 @@ gtk_application_window_active_cb (GtkWindow *window,
|
||||
priv->windows = g_list_concat (link, priv->windows);
|
||||
}
|
||||
|
||||
if (application->priv->impl)
|
||||
gtk_application_impl_active_window_changed (application->priv->impl, window);
|
||||
if (priv->impl)
|
||||
gtk_application_impl_active_window_changed (priv->impl, window);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (application), gtk_application_props[PROP_ACTIVE_WINDOW]);
|
||||
}
|
||||
@@ -192,6 +192,7 @@ gtk_application_window_active_cb (GtkWindow *window,
|
||||
static void
|
||||
gtk_application_load_resources (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
const gchar *base_path;
|
||||
|
||||
base_path = g_application_get_resource_base_path (G_APPLICATION (application));
|
||||
@@ -223,15 +224,15 @@ gtk_application_load_resources (GtkApplication *application)
|
||||
menuspath = g_strconcat (base_path, "/gtk/menus-traditional.ui", NULL);
|
||||
|
||||
if (g_resources_get_info (menuspath, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
||||
application->priv->menus_builder = gtk_builder_new_from_resource (menuspath);
|
||||
priv->menus_builder = gtk_builder_new_from_resource (menuspath);
|
||||
g_free (menuspath);
|
||||
|
||||
/* If we didn't get the specific file, fall back. */
|
||||
if (application->priv->menus_builder == NULL)
|
||||
if (priv->menus_builder == NULL)
|
||||
{
|
||||
menuspath = g_strconcat (base_path, "/gtk/menus.ui", NULL);
|
||||
if (g_resources_get_info (menuspath, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
|
||||
application->priv->menus_builder = gtk_builder_new_from_resource (menuspath);
|
||||
priv->menus_builder = gtk_builder_new_from_resource (menuspath);
|
||||
g_free (menuspath);
|
||||
}
|
||||
|
||||
@@ -241,22 +242,22 @@ gtk_application_load_resources (GtkApplication *application)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (application->priv->menus_builder == NULL)
|
||||
application->priv->menus_builder = gtk_builder_new ();
|
||||
if (priv->menus_builder == NULL)
|
||||
priv->menus_builder = gtk_builder_new ();
|
||||
|
||||
if (!gtk_builder_add_from_resource (application->priv->menus_builder, menuspath, &error))
|
||||
if (!gtk_builder_add_from_resource (priv->menus_builder, menuspath, &error))
|
||||
g_error ("failed to load menus-common.ui: %s", error->message);
|
||||
}
|
||||
g_free (menuspath);
|
||||
|
||||
if (application->priv->menus_builder)
|
||||
if (priv->menus_builder)
|
||||
{
|
||||
GObject *menu;
|
||||
|
||||
menu = gtk_builder_get_object (application->priv->menus_builder, "app-menu");
|
||||
menu = gtk_builder_get_object (priv->menus_builder, "app-menu");
|
||||
if (menu != NULL && G_IS_MENU_MODEL (menu))
|
||||
gtk_application_set_app_menu (application, G_MENU_MODEL (menu));
|
||||
menu = gtk_builder_get_object (application->priv->menus_builder, "menubar");
|
||||
menu = gtk_builder_get_object (priv->menus_builder, "menubar");
|
||||
if (menu != NULL && G_IS_MENU_MODEL (menu))
|
||||
gtk_application_set_menubar (application, G_MENU_MODEL (menu));
|
||||
}
|
||||
@@ -271,7 +272,7 @@ gtk_application_load_resources (GtkApplication *application)
|
||||
{
|
||||
const gchar * const accels[] = { "<Primary>F1", "<Primary>question", NULL };
|
||||
|
||||
application->priv->help_overlay_path = path;
|
||||
priv->help_overlay_path = path;
|
||||
gtk_application_set_accels_for_action (application, "win.show-help-overlay", accels);
|
||||
}
|
||||
else
|
||||
@@ -286,15 +287,16 @@ static void
|
||||
gtk_application_startup (GApplication *g_application)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (g_application);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
G_APPLICATION_CLASS (gtk_application_parent_class)->startup (g_application);
|
||||
|
||||
gtk_action_muxer_insert (application->priv->muxer, "app", G_ACTION_GROUP (application));
|
||||
gtk_action_muxer_insert (priv->muxer, "app", G_ACTION_GROUP (application));
|
||||
|
||||
gtk_init ();
|
||||
|
||||
application->priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
|
||||
gtk_application_impl_startup (application->priv->impl, application->priv->register_session);
|
||||
priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
|
||||
gtk_application_impl_startup (priv->impl, priv->register_session);
|
||||
|
||||
gtk_application_load_resources (application);
|
||||
}
|
||||
@@ -303,14 +305,15 @@ static void
|
||||
gtk_application_shutdown (GApplication *g_application)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (g_application);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
if (application->priv->impl == NULL)
|
||||
if (priv->impl == NULL)
|
||||
return;
|
||||
|
||||
gtk_application_impl_shutdown (application->priv->impl);
|
||||
g_clear_object (&application->priv->impl);
|
||||
gtk_application_impl_shutdown (priv->impl);
|
||||
g_clear_object (&priv->impl);
|
||||
|
||||
gtk_action_muxer_remove (application->priv->muxer, "app");
|
||||
gtk_action_muxer_remove (priv->muxer, "app");
|
||||
|
||||
gtk_main_sync ();
|
||||
|
||||
@@ -355,8 +358,9 @@ gtk_application_before_emit (GApplication *g_application,
|
||||
GVariant *platform_data)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (g_application);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
gtk_application_impl_before_emit (application->priv->impl, platform_data);
|
||||
gtk_application_impl_before_emit (priv->impl, platform_data);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -379,18 +383,20 @@ gtk_application_after_emit (GApplication *application,
|
||||
static void
|
||||
gtk_application_init (GtkApplication *application)
|
||||
{
|
||||
application->priv = gtk_application_get_instance_private (application);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
application->priv->muxer = gtk_action_muxer_new ();
|
||||
priv = gtk_application_get_instance_private (application);
|
||||
|
||||
application->priv->accels = gtk_application_accels_new ();
|
||||
priv->muxer = gtk_action_muxer_new ();
|
||||
|
||||
priv->accels = gtk_application_accels_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_window_added (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
GtkApplicationPrivate *priv = application->priv;
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
if (GTK_IS_APPLICATION_WINDOW (window))
|
||||
{
|
||||
@@ -428,7 +434,7 @@ static void
|
||||
gtk_application_window_removed (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
GtkApplicationPrivate *priv = application->priv;
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
gpointer old_active;
|
||||
|
||||
old_active = priv->windows;
|
||||
@@ -520,11 +526,12 @@ gtk_application_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (object);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_REGISTER_SESSION:
|
||||
g_value_set_boolean (value, application->priv->register_session);
|
||||
g_value_set_boolean (value, priv->register_session);
|
||||
break;
|
||||
|
||||
case PROP_APP_MENU:
|
||||
@@ -552,11 +559,12 @@ gtk_application_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (object);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_REGISTER_SESSION:
|
||||
application->priv->register_session = g_value_get_boolean (value);
|
||||
priv->register_session = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
case PROP_APP_MENU:
|
||||
@@ -577,14 +585,15 @@ static void
|
||||
gtk_application_finalize (GObject *object)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (object);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_clear_object (&application->priv->menus_builder);
|
||||
g_clear_object (&application->priv->app_menu);
|
||||
g_clear_object (&application->priv->menubar);
|
||||
g_clear_object (&application->priv->muxer);
|
||||
g_clear_object (&application->priv->accels);
|
||||
g_clear_object (&priv->menus_builder);
|
||||
g_clear_object (&priv->app_menu);
|
||||
g_clear_object (&priv->menubar);
|
||||
g_clear_object (&priv->muxer);
|
||||
g_clear_object (&priv->accels);
|
||||
|
||||
g_free (application->priv->help_overlay_path);
|
||||
g_free (priv->help_overlay_path);
|
||||
|
||||
G_OBJECT_CLASS (gtk_application_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -745,6 +754,8 @@ void
|
||||
gtk_application_add_window (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
|
||||
@@ -755,7 +766,7 @@ gtk_application_add_window (GtkApplication *application,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_list_find (application->priv->windows, window))
|
||||
if (!g_list_find (priv->windows, window))
|
||||
g_signal_emit (application,
|
||||
gtk_application_signals[WINDOW_ADDED], 0, window);
|
||||
}
|
||||
@@ -778,10 +789,12 @@ void
|
||||
gtk_application_remove_window (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
|
||||
if (g_list_find (application->priv->windows, window))
|
||||
if (g_list_find (priv->windows, window))
|
||||
g_signal_emit (application,
|
||||
gtk_application_signals[WINDOW_REMOVED], 0, window);
|
||||
}
|
||||
@@ -805,9 +818,11 @@ gtk_application_remove_window (GtkApplication *application,
|
||||
GList *
|
||||
gtk_application_get_windows (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
return application->priv->windows;
|
||||
return priv->windows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -827,11 +842,12 @@ GtkWindow *
|
||||
gtk_application_get_window_by_id (GtkApplication *application,
|
||||
guint id)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GList *l;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
for (l = application->priv->windows; l != NULL; l = l->next)
|
||||
for (l = priv->windows; l != NULL; l = l->next)
|
||||
{
|
||||
if (GTK_IS_APPLICATION_WINDOW (l->data) &&
|
||||
gtk_application_window_get_id (GTK_APPLICATION_WINDOW (l->data)) == id)
|
||||
@@ -858,17 +874,20 @@ gtk_application_get_window_by_id (GtkApplication *application,
|
||||
GtkWindow *
|
||||
gtk_application_get_active_window (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
return application->priv->windows ? application->priv->windows->data : NULL;
|
||||
return priv->windows ? priv->windows->data : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_update_accels (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GList *l;
|
||||
|
||||
for (l = application->priv->windows; l != NULL; l = l->next)
|
||||
for (l = priv->windows; l != NULL; l = l->next)
|
||||
_gtk_window_notify_keys_changed (l->data);
|
||||
}
|
||||
|
||||
@@ -916,10 +935,12 @@ gtk_application_update_accels (GtkApplication *application)
|
||||
gboolean
|
||||
gtk_application_prefers_app_menu (GtkApplication *application)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
|
||||
g_return_val_if_fail (application->priv->impl != NULL, FALSE);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
return gtk_application_impl_prefers_app_menu (application->priv->impl);
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
|
||||
g_return_val_if_fail (priv->impl != NULL, FALSE);
|
||||
|
||||
return gtk_application_impl_prefers_app_menu (priv->impl);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -949,17 +970,19 @@ void
|
||||
gtk_application_set_app_menu (GtkApplication *application,
|
||||
GMenuModel *app_menu)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (g_application_get_is_registered (G_APPLICATION (application)));
|
||||
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
|
||||
g_return_if_fail (app_menu == NULL || G_IS_MENU_MODEL (app_menu));
|
||||
|
||||
if (g_set_object (&application->priv->app_menu, app_menu))
|
||||
if (g_set_object (&priv->app_menu, app_menu))
|
||||
{
|
||||
if (app_menu)
|
||||
extract_accels_from_menu (app_menu, application);
|
||||
|
||||
gtk_application_impl_set_app_menu (application->priv->impl, app_menu);
|
||||
gtk_application_impl_set_app_menu (priv->impl, app_menu);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (application), gtk_application_props[PROP_APP_MENU]);
|
||||
}
|
||||
@@ -978,9 +1001,11 @@ gtk_application_set_app_menu (GtkApplication *application,
|
||||
GMenuModel *
|
||||
gtk_application_get_app_menu (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
return application->priv->app_menu;
|
||||
return priv->app_menu;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1011,17 +1036,19 @@ void
|
||||
gtk_application_set_menubar (GtkApplication *application,
|
||||
GMenuModel *menubar)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (g_application_get_is_registered (G_APPLICATION (application)));
|
||||
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
|
||||
g_return_if_fail (menubar == NULL || G_IS_MENU_MODEL (menubar));
|
||||
|
||||
if (g_set_object (&application->priv->menubar, menubar))
|
||||
if (g_set_object (&priv->menubar, menubar))
|
||||
{
|
||||
if (menubar)
|
||||
extract_accels_from_menu (menubar, application);
|
||||
|
||||
gtk_application_impl_set_menubar (application->priv->impl, menubar);
|
||||
gtk_application_impl_set_menubar (priv->impl, menubar);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (application), gtk_application_props[PROP_MENUBAR]);
|
||||
}
|
||||
@@ -1039,9 +1066,11 @@ gtk_application_set_menubar (GtkApplication *application,
|
||||
GMenuModel *
|
||||
gtk_application_get_menubar (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
return application->priv->menubar;
|
||||
return priv->menubar;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1098,11 +1127,13 @@ gtk_application_inhibit (GtkApplication *application,
|
||||
GtkApplicationInhibitFlags flags,
|
||||
const gchar *reason)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), 0);
|
||||
g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), 0);
|
||||
g_return_val_if_fail (window == NULL || GTK_IS_WINDOW (window), 0);
|
||||
|
||||
return gtk_application_impl_inhibit (application->priv->impl, window, flags, reason);
|
||||
return gtk_application_impl_inhibit (priv->impl, window, flags, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1117,30 +1148,33 @@ void
|
||||
gtk_application_uninhibit (GtkApplication *application,
|
||||
guint cookie)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
|
||||
g_return_if_fail (cookie > 0);
|
||||
|
||||
gtk_application_impl_uninhibit (application->priv->impl, cookie);
|
||||
gtk_application_impl_uninhibit (priv->impl, cookie);
|
||||
}
|
||||
|
||||
GtkActionMuxer *
|
||||
gtk_application_get_parent_muxer_for_window (GtkWindow *window)
|
||||
{
|
||||
GtkApplication *application;
|
||||
|
||||
application = gtk_window_get_application (window);
|
||||
GtkApplication *application = gtk_window_get_application (window);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
if (!application)
|
||||
return NULL;
|
||||
|
||||
return application->priv->muxer;
|
||||
return priv->muxer;
|
||||
}
|
||||
|
||||
GtkApplicationAccels *
|
||||
gtk_application_get_application_accels (GtkApplication *application)
|
||||
{
|
||||
return application->priv->accels;
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
return priv->accels;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1156,9 +1190,11 @@ gtk_application_get_application_accels (GtkApplication *application)
|
||||
gchar **
|
||||
gtk_application_list_action_descriptions (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
|
||||
return gtk_application_accels_list_action_descriptions (application->priv->accels);
|
||||
return gtk_application_accels_list_action_descriptions (priv->accels);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1184,18 +1220,19 @@ gtk_application_set_accels_for_action (GtkApplication *application,
|
||||
const gchar *detailed_action_name,
|
||||
const gchar * const *accels)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
gchar *action_and_target;
|
||||
|
||||
g_return_if_fail (GTK_IS_APPLICATION (application));
|
||||
g_return_if_fail (detailed_action_name != NULL);
|
||||
g_return_if_fail (accels != NULL);
|
||||
|
||||
gtk_application_accels_set_accels_for_action (application->priv->accels,
|
||||
gtk_application_accels_set_accels_for_action (priv->accels,
|
||||
detailed_action_name,
|
||||
accels);
|
||||
|
||||
action_and_target = gtk_normalise_detailed_action_name (detailed_action_name);
|
||||
gtk_action_muxer_set_primary_accel (application->priv->muxer, action_and_target, accels[0]);
|
||||
gtk_action_muxer_set_primary_accel (priv->muxer, action_and_target, accels[0]);
|
||||
g_free (action_and_target);
|
||||
|
||||
gtk_application_update_accels (application);
|
||||
@@ -1217,10 +1254,12 @@ gchar **
|
||||
gtk_application_get_accels_for_action (GtkApplication *application,
|
||||
const gchar *detailed_action_name)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
g_return_val_if_fail (detailed_action_name != NULL, NULL);
|
||||
|
||||
return gtk_application_accels_get_accels_for_action (application->priv->accels,
|
||||
return gtk_application_accels_get_accels_for_action (priv->accels,
|
||||
detailed_action_name);
|
||||
}
|
||||
|
||||
@@ -1251,18 +1290,22 @@ gchar **
|
||||
gtk_application_get_actions_for_accel (GtkApplication *application,
|
||||
const gchar *accel)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
g_return_val_if_fail (accel != NULL, NULL);
|
||||
|
||||
return gtk_application_accels_get_actions_for_accel (application->priv->accels, accel);
|
||||
return gtk_application_accels_get_actions_for_accel (priv->accels, accel);
|
||||
}
|
||||
|
||||
GtkActionMuxer *
|
||||
gtk_application_get_action_muxer (GtkApplication *application)
|
||||
{
|
||||
g_assert (application->priv->muxer);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
return application->priv->muxer;
|
||||
g_assert (priv->muxer);
|
||||
|
||||
return priv->muxer;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1270,23 +1313,29 @@ gtk_application_insert_action_group (GtkApplication *application,
|
||||
const gchar *name,
|
||||
GActionGroup *action_group)
|
||||
{
|
||||
gtk_action_muxer_insert (application->priv->muxer, name, action_group);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
gtk_action_muxer_insert (priv->muxer, name, action_group);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_application_handle_window_realize (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
if (application->priv->impl)
|
||||
gtk_application_impl_handle_window_realize (application->priv->impl, window);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
if (priv->impl)
|
||||
gtk_application_impl_handle_window_realize (priv->impl, window);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_application_handle_window_map (GtkApplication *application,
|
||||
GtkWindow *window)
|
||||
{
|
||||
if (application->priv->impl)
|
||||
gtk_application_impl_handle_window_map (application->priv->impl, window);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
|
||||
if (priv->impl)
|
||||
gtk_application_impl_handle_window_map (priv->impl, window);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1305,15 +1354,16 @@ GMenu *
|
||||
gtk_application_get_menu_by_id (GtkApplication *application,
|
||||
const gchar *id)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GObject *object;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), NULL);
|
||||
g_return_val_if_fail (id != NULL, NULL);
|
||||
|
||||
if (!application->priv->menus_builder)
|
||||
if (!priv->menus_builder)
|
||||
return NULL;
|
||||
|
||||
object = gtk_builder_get_object (application->priv->menus_builder, id);
|
||||
object = gtk_builder_get_object (priv->menus_builder, id);
|
||||
|
||||
if (!object || !G_IS_MENU (object))
|
||||
return NULL;
|
||||
|
||||
@@ -38,14 +38,10 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkApplication GtkApplication;
|
||||
typedef struct _GtkApplicationClass GtkApplicationClass;
|
||||
typedef struct _GtkApplicationPrivate GtkApplicationPrivate;
|
||||
|
||||
struct _GtkApplication
|
||||
{
|
||||
GApplication parent;
|
||||
|
||||
/*< private >*/
|
||||
GtkApplicationPrivate *priv;
|
||||
GApplication parent_instance;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+12
-15
@@ -56,13 +56,13 @@
|
||||
|
||||
|
||||
|
||||
struct _GtkAspectFramePrivate
|
||||
typedef struct
|
||||
{
|
||||
gboolean obey_child;
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
gfloat ratio;
|
||||
};
|
||||
} GtkAspectFramePrivate;
|
||||
|
||||
|
||||
enum {
|
||||
@@ -138,12 +138,12 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
|
||||
static void
|
||||
gtk_aspect_frame_init (GtkAspectFrame *aspect_frame)
|
||||
{
|
||||
aspect_frame->priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
GtkAspectFramePrivate *priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
|
||||
aspect_frame->priv->xalign = 0.5;
|
||||
aspect_frame->priv->yalign = 0.5;
|
||||
aspect_frame->priv->ratio = 1.0;
|
||||
aspect_frame->priv->obey_child = TRUE;
|
||||
priv->xalign = 0.5;
|
||||
priv->yalign = 0.5;
|
||||
priv->ratio = 1.0;
|
||||
priv->obey_child = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -153,7 +153,7 @@ gtk_aspect_frame_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object);
|
||||
GtkAspectFramePrivate *priv = aspect_frame->priv;
|
||||
GtkAspectFramePrivate *priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -199,7 +199,7 @@ gtk_aspect_frame_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object);
|
||||
GtkAspectFramePrivate *priv = aspect_frame->priv;
|
||||
GtkAspectFramePrivate *priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@@ -249,8 +249,7 @@ gtk_aspect_frame_new (const gchar *label,
|
||||
GtkAspectFramePrivate *priv;
|
||||
|
||||
aspect_frame = g_object_new (GTK_TYPE_ASPECT_FRAME, NULL);
|
||||
|
||||
priv = aspect_frame->priv;
|
||||
priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
|
||||
priv->xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
priv->yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
@@ -284,12 +283,10 @@ gtk_aspect_frame_set (GtkAspectFrame *aspect_frame,
|
||||
gfloat ratio,
|
||||
gboolean obey_child)
|
||||
{
|
||||
GtkAspectFramePrivate *priv;
|
||||
GtkAspectFramePrivate *priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
|
||||
g_return_if_fail (GTK_IS_ASPECT_FRAME (aspect_frame));
|
||||
|
||||
priv = aspect_frame->priv;
|
||||
|
||||
xalign = CLAMP (xalign, 0.0, 1.0);
|
||||
yalign = CLAMP (yalign, 0.0, 1.0);
|
||||
ratio = CLAMP (ratio, MIN_RATIO, MAX_RATIO);
|
||||
@@ -333,7 +330,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
|
||||
GtkAllocation *child_allocation)
|
||||
{
|
||||
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame);
|
||||
GtkAspectFramePrivate *priv = aspect_frame->priv;
|
||||
GtkAspectFramePrivate *priv = gtk_aspect_frame_get_instance_private (aspect_frame);
|
||||
GtkBin *bin = GTK_BIN (frame);
|
||||
GtkWidget *child;
|
||||
gdouble ratio;
|
||||
|
||||
@@ -43,15 +43,11 @@ G_BEGIN_DECLS
|
||||
#define GTK_ASPECT_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASPECT_FRAME, GtkAspectFrameClass))
|
||||
|
||||
typedef struct _GtkAspectFrame GtkAspectFrame;
|
||||
typedef struct _GtkAspectFramePrivate GtkAspectFramePrivate;
|
||||
typedef struct _GtkAspectFrameClass GtkAspectFrameClass;
|
||||
|
||||
struct _GtkAspectFrame
|
||||
{
|
||||
GtkFrame frame;
|
||||
|
||||
/*< private >*/
|
||||
GtkAspectFramePrivate *priv;
|
||||
GtkFrame parent_instance;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+8
-8
@@ -308,7 +308,7 @@ static gboolean gtk_calendar_query_tooltip (GtkWidget *widget,
|
||||
GtkTooltip *tooltip);
|
||||
|
||||
static void gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data);
|
||||
static void gtk_calendar_drag_data_received (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@@ -2660,7 +2660,7 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
GtkWidget *widget = data;
|
||||
GtkCalendarPrivate *priv = GTK_CALENDAR (widget)->priv;
|
||||
gdouble start_x, start_y;
|
||||
GdkDragContext *context;
|
||||
GdkDrag *drag;
|
||||
GdkContentFormats *targets;
|
||||
|
||||
if (!priv->in_drag)
|
||||
@@ -2675,15 +2675,15 @@ gtk_calendar_drag_update (GtkGestureDrag *gesture,
|
||||
|
||||
targets = gdk_content_formats_new (NULL, 0);
|
||||
targets = gtk_content_formats_add_text_targets (targets);
|
||||
context = gtk_drag_begin_with_coordinates (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
targets, GDK_ACTION_COPY,
|
||||
start_x, start_y);
|
||||
drag = gtk_drag_begin (widget,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
targets, GDK_ACTION_COPY,
|
||||
start_x, start_y);
|
||||
|
||||
priv->in_drag = 0;
|
||||
gdk_content_formats_unref (targets);
|
||||
|
||||
gtk_drag_set_icon_default (context);
|
||||
gtk_drag_set_icon_default (drag);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2900,7 +2900,7 @@ gtk_calendar_grab_notify (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
gtk_calendar_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data)
|
||||
{
|
||||
GtkCalendar *calendar = GTK_CALENDAR (widget);
|
||||
|
||||
@@ -110,10 +110,10 @@ static void gtk_color_button_clicked (GtkButton *button,
|
||||
|
||||
/* source side drag signals */
|
||||
static void gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data);
|
||||
static void gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
GtkColorButton *button);
|
||||
|
||||
@@ -312,7 +312,7 @@ gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
set_color_icon (GdkDragContext *context,
|
||||
set_color_icon (GdkDrag *drag,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
@@ -324,24 +324,24 @@ set_color_icon (GdkDragContext *context,
|
||||
&GRAPHENE_RECT_INIT(0, 0, 48, 32));
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, NULL);
|
||||
|
||||
gtk_drag_set_icon_paintable (context, paintable, 0, 0);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, 0, 0);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorButton *button = data;
|
||||
GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
|
||||
|
||||
set_color_icon (context, &priv->rgba);
|
||||
set_color_icon (drag, &priv->rgba);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
GtkColorButton *button)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
#include "gtkcolorscaleprivate.h"
|
||||
#include "gtkcolorswatchprivate.h"
|
||||
#include "gtkcolorutils.h"
|
||||
#include "gtkcolorpickerprivate.h"
|
||||
#include "gtkgrid.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkentry.h"
|
||||
@@ -61,6 +63,9 @@ struct _GtkColorEditorPrivate
|
||||
GtkAdjustment *v_adj;
|
||||
GtkAdjustment *a_adj;
|
||||
|
||||
GtkWidget *picker_button;
|
||||
GtkColorPicker *picker;
|
||||
|
||||
gint popup_position;
|
||||
|
||||
guint text_changed : 1;
|
||||
@@ -337,6 +342,36 @@ scaled_adjustment (GtkAdjustment *a,
|
||||
return as;
|
||||
}
|
||||
|
||||
static void
|
||||
color_picked (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorPicker *picker = GTK_COLOR_PICKER (source);
|
||||
GtkColorEditor *editor = data;
|
||||
GError *error = NULL;
|
||||
GdkRGBA *color;
|
||||
|
||||
color = gtk_color_picker_pick_finish (picker, res, &error);
|
||||
if (color == NULL)
|
||||
{
|
||||
g_warning ("Picking color failed: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (editor), color);
|
||||
gdk_rgba_free (color);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pick_color (GtkButton *button,
|
||||
GtkColorEditor *editor)
|
||||
{
|
||||
gtk_color_picker_pick (editor->priv->picker, color_picked, editor);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_editor_init (GtkColorEditor *editor)
|
||||
{
|
||||
@@ -385,6 +420,10 @@ gtk_color_editor_init (GtkColorEditor *editor)
|
||||
gtk_widget_add_controller (editor->priv->a_entry, controller);
|
||||
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (editor->priv->swatch), "activatable");
|
||||
|
||||
editor->priv->picker = gtk_color_picker_new ();
|
||||
if (editor->priv->picker == NULL)
|
||||
gtk_widget_hide (editor->priv->picker_button);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -393,6 +432,7 @@ gtk_color_editor_dispose (GObject *object)
|
||||
GtkColorEditor *editor = GTK_COLOR_EDITOR (object);
|
||||
|
||||
dismiss_current_popup (editor);
|
||||
g_clear_object (&editor->priv->picker);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -495,6 +535,7 @@ gtk_color_editor_class_init (GtkColorEditorClass *class)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, s_adj);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, v_adj);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, a_adj);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkColorEditor, picker_button);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, hsv_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, dismiss_current_popup);
|
||||
@@ -503,6 +544,7 @@ gtk_color_editor_class_init (GtkColorEditorClass *class)
|
||||
gtk_widget_class_bind_template_callback (widget_class, entry_apply);
|
||||
gtk_widget_class_bind_template_callback (widget_class, entry_focus_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, popup_edit);
|
||||
gtk_widget_class_bind_template_callback (widget_class, pick_color);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user