Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Dorota Czaplejewicz
gtk
Commits
a24bbcbb
Commit
a24bbcbb
authored
Dec 07, 2015
by
Matthias Clasen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnd: Pass start coordinates when creating the drag context
This will be used in subsequent commits.
parent
268c7a3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
20 deletions
+21
-20
gtk/gtkdnd.c
gtk/gtkdnd.c
+21
-20
No files found.
gtk/gtkdnd.c
View file @
a24bbcbb
...
...
@@ -2173,6 +2173,7 @@ gtk_drag_begin_internal (GtkWidget *widget,
GdkCursor
*
cursor
;
GdkDevice
*
pointer
,
*
keyboard
;
GdkWindow
*
ipc_window
;
gint
start_x
,
start_y
;
pointer
=
keyboard
=
NULL
;
ipc_widget
=
gtk_drag_get_ipc_widget
(
widget
);
...
...
@@ -2244,7 +2245,24 @@ gtk_drag_begin_internal (GtkWidget *widget,
source_widgets
=
g_slist_prepend
(
source_widgets
,
ipc_widget
);
context
=
gdk_drag_begin_for_device
(
ipc_window
,
pointer
,
targets
);
if
(
x
!=
-
1
&&
y
!=
-
1
)
{
GtkWidget
*
toplevel
=
gtk_widget_get_toplevel
(
widget
);
gtk_widget_translate_coordinates
(
widget
,
toplevel
,
x
,
y
,
&
x
,
&
y
);
gdk_window_get_root_coords
(
gtk_widget_get_window
(
toplevel
),
x
,
y
,
&
start_x
,
&
start_y
);
}
else
if
(
event
&&
event
->
type
==
GDK_MOTION_NOTIFY
)
{
start_x
=
event
->
motion
.
x_root
;
start_y
=
event
->
motion
.
y_root
;
}
else
gdk_device_get_position
(
pointer
,
NULL
,
&
start_x
,
&
start_y
);
context
=
gdk_drag_begin_from_point
(
ipc_window
,
pointer
,
targets
,
start_x
,
start_y
);
gdk_drag_context_set_device
(
context
,
pointer
);
g_list_free
(
targets
);
...
...
@@ -2269,30 +2287,13 @@ gtk_drag_begin_internal (GtkWidget *widget,
info
->
icon_widget
=
NULL
;
info
->
destroy_icon
=
FALSE
;
/* Set cur_x, cur_y here so if the "drag-begin" signal shows
* the drag icon, it will be in the right place
*/
if
(
event
)
info
->
cur_screen
=
gdk_event_get_screen
(
event
);
else
gdk_device_get_position
(
pointer
,
&
info
->
cur_screen
,
NULL
,
NULL
);
if
(
x
!=
-
1
&&
y
!=
-
1
)
{
GtkWidget
*
toplevel
=
gtk_widget_get_toplevel
(
widget
);
gtk_widget_translate_coordinates
(
widget
,
toplevel
,
x
,
y
,
&
x
,
&
y
);
gdk_window_get_root_coords
(
gtk_widget_get_window
(
toplevel
),
x
,
y
,
&
info
->
start_x
,
&
info
->
start_y
);
}
else
if
(
event
&&
event
->
type
==
GDK_MOTION_NOTIFY
)
{
info
->
start_x
=
event
->
motion
.
x_root
;
info
->
start_y
=
event
->
motion
.
y_root
;
}
else
gdk_device_get_position
(
pointer
,
NULL
,
&
info
->
start_x
,
&
info
->
start_y
);
info
->
start_x
=
start_x
;
info
->
start_y
=
start_y
;
g_signal_emit_by_name
(
widget
,
"drag-begin"
,
info
->
context
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment