forked from AuroraMiddleware/gtk
Change coordinate translation apis to take doubles
Change gtk_widget_translate_coordinates and gtk_native_get_surface_transform to operate on doubles. Update all callers.
This commit is contained in:
parent
93d4253c93
commit
75d9310986
@ -1043,7 +1043,7 @@ gtk_cell_area_real_event (GtkCellArea *area,
|
|||||||
GtkCellRenderer *focus_renderer;
|
GtkCellRenderer *focus_renderer;
|
||||||
GdkRectangle alloc_area;
|
GdkRectangle alloc_area;
|
||||||
double event_x, event_y;
|
double event_x, event_y;
|
||||||
int x, y;
|
double x, y;
|
||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
|
|
||||||
/* We may need some semantics to tell us the offset of the event
|
/* We may need some semantics to tell us the offset of the event
|
||||||
|
@ -274,6 +274,7 @@ get_child_position (GtkOverlay *overlay,
|
|||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
GtkAllocation alloc;
|
GtkAllocation alloc;
|
||||||
gint s, e;
|
gint s, e;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (widget, &req, NULL);
|
gtk_widget_get_preferred_size (widget, &req, NULL);
|
||||||
|
|
||||||
@ -287,11 +288,11 @@ get_child_position (GtkOverlay *overlay,
|
|||||||
gtk_widget_translate_coordinates (editor->sv_plane,
|
gtk_widget_translate_coordinates (editor->sv_plane,
|
||||||
gtk_widget_get_parent (editor->grid),
|
gtk_widget_get_parent (editor->grid),
|
||||||
0, -6,
|
0, -6,
|
||||||
&allocation->x, &allocation->y);
|
&x, &y);
|
||||||
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
|
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
|
||||||
allocation->x = 0;
|
x = 0;
|
||||||
else
|
else
|
||||||
allocation->x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
|
x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
|
||||||
}
|
}
|
||||||
else if (widget == editor->h_popup)
|
else if (widget == editor->h_popup)
|
||||||
{
|
{
|
||||||
@ -302,12 +303,12 @@ get_child_position (GtkOverlay *overlay,
|
|||||||
gtk_widget_translate_coordinates (editor->h_slider,
|
gtk_widget_translate_coordinates (editor->h_slider,
|
||||||
gtk_widget_get_parent (editor->grid),
|
gtk_widget_get_parent (editor->grid),
|
||||||
- req.width - 6, editor->popup_position - req.height / 2,
|
- req.width - 6, editor->popup_position - req.height / 2,
|
||||||
&allocation->x, &allocation->y);
|
&x, &y);
|
||||||
else
|
else
|
||||||
gtk_widget_translate_coordinates (editor->h_slider,
|
gtk_widget_translate_coordinates (editor->h_slider,
|
||||||
gtk_widget_get_parent (editor->grid),
|
gtk_widget_get_parent (editor->grid),
|
||||||
alloc.width + 6, editor->popup_position - req.height / 2,
|
alloc.width + 6, editor->popup_position - req.height / 2,
|
||||||
&allocation->x, &allocation->y);
|
&x, &y);
|
||||||
}
|
}
|
||||||
else if (widget == editor->a_popup)
|
else if (widget == editor->a_popup)
|
||||||
{
|
{
|
||||||
@ -317,13 +318,13 @@ get_child_position (GtkOverlay *overlay,
|
|||||||
gtk_widget_translate_coordinates (editor->a_slider,
|
gtk_widget_translate_coordinates (editor->a_slider,
|
||||||
gtk_widget_get_parent (editor->grid),
|
gtk_widget_get_parent (editor->grid),
|
||||||
editor->popup_position - req.width / 2, - req.height - 6,
|
editor->popup_position - req.width / 2, - req.height - 6,
|
||||||
&allocation->x, &allocation->y);
|
&x, &y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
allocation->x = CLAMP (allocation->x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
|
allocation->x = CLAMP (x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
|
||||||
allocation->y = CLAMP (allocation->y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
|
allocation->y = CLAMP (y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,8 @@ gtk_drag_icon_native_get_renderer (GtkNative *native)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_drag_icon_native_get_surface_transform (GtkNative *native,
|
gtk_drag_icon_native_get_surface_transform (GtkNative *native,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
GtkCssBoxes css_boxes;
|
GtkCssBoxes css_boxes;
|
||||||
const graphene_rect_t *margin_rect;
|
const graphene_rect_t *margin_rect;
|
||||||
|
@ -490,7 +490,7 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
|||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
int x, y;
|
double x, y;
|
||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double px, py;
|
double px, py;
|
||||||
@ -509,8 +509,8 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
|||||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), source->start_x, source->start_y, &x, &y);
|
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), source->start_x, source->start_y, &x, &y);
|
||||||
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
||||||
|
|
||||||
dx = round (px) - x;
|
dx = round (px - x);
|
||||||
dy = round (py) - y;
|
dy = round (py - y);
|
||||||
|
|
||||||
g_signal_emit (source, signals[PREPARE], 0, source->start_x, source->start_y, &content);
|
g_signal_emit (source, signals[PREPARE], 0, source->start_x, source->start_y, &content);
|
||||||
if (!content)
|
if (!content)
|
||||||
|
@ -253,7 +253,7 @@ scroll_to_child (GtkWidget *child)
|
|||||||
GtkEmojiChooser *chooser;
|
GtkEmojiChooser *chooser;
|
||||||
GtkAdjustment *adj;
|
GtkAdjustment *adj;
|
||||||
GtkAllocation alloc;
|
GtkAllocation alloc;
|
||||||
int pos;
|
double pos;
|
||||||
double value;
|
double value;
|
||||||
double page_size;
|
double page_size;
|
||||||
|
|
||||||
|
@ -2799,7 +2799,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
|
|||||||
for (i = 0; i < MAX_ICONS; i++)
|
for (i = 0; i < MAX_ICONS; i++)
|
||||||
{
|
{
|
||||||
EntryIconInfo *icon_info = priv->icons[i];
|
EntryIconInfo *icon_info = priv->icons[i];
|
||||||
int icon_x, icon_y;
|
double icon_x, icon_y;
|
||||||
|
|
||||||
if (icon_info == NULL)
|
if (icon_info == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1428,6 +1428,7 @@ rename_selected_cb (GtkTreeModel *model,
|
|||||||
GtkFileChooserWidget *impl = data;
|
GtkFileChooserWidget *impl = data;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
gchar *filename;
|
gchar *filename;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
gtk_tree_model_get (model, iter,
|
gtk_tree_model_get (model, iter,
|
||||||
MODEL_COL_FILE, &impl->rename_file_source_file,
|
MODEL_COL_FILE, &impl->rename_file_source_file,
|
||||||
@ -1442,7 +1443,9 @@ rename_selected_cb (GtkTreeModel *model,
|
|||||||
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
||||||
GTK_WIDGET (impl),
|
GTK_WIDGET (impl),
|
||||||
rect.x, rect.y,
|
rect.x, rect.y,
|
||||||
&rect.x, &rect.y);
|
&x, &y);
|
||||||
|
rect.x = x;
|
||||||
|
rect.y = y;
|
||||||
|
|
||||||
filename = g_file_get_basename (impl->rename_file_source_file);
|
filename = g_file_get_basename (impl->rename_file_source_file);
|
||||||
gtk_editable_set_text (GTK_EDITABLE (impl->rename_file_name_entry), filename);
|
gtk_editable_set_text (GTK_EDITABLE (impl->rename_file_name_entry), filename);
|
||||||
@ -2009,9 +2012,10 @@ file_list_show_popover (GtkFileChooserWidget *impl,
|
|||||||
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
||||||
GTK_WIDGET (impl),
|
GTK_WIDGET (impl),
|
||||||
rect.x, rect.y,
|
rect.x, rect.y,
|
||||||
&rect.x, &rect.y);
|
&x, &y);
|
||||||
|
|
||||||
rect.x = CLAMP (x - 20, 0, bounds.size.width - 40);
|
rect.x = CLAMP (x - 20, 0, bounds.size.width - 40);
|
||||||
|
rect.y = y;
|
||||||
rect.width = 40;
|
rect.width = 40;
|
||||||
|
|
||||||
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
|
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
|
||||||
@ -2113,15 +2117,14 @@ click_cb (GtkGesture *gesture,
|
|||||||
GtkFileChooserWidget *impl)
|
GtkFileChooserWidget *impl)
|
||||||
{
|
{
|
||||||
PopoverData *pd;
|
PopoverData *pd;
|
||||||
int xx, yy;
|
|
||||||
|
|
||||||
pd = g_new (PopoverData, 1);
|
pd = g_new (PopoverData, 1);
|
||||||
pd->impl = impl;
|
pd->impl = impl;
|
||||||
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
||||||
GTK_WIDGET (impl),
|
GTK_WIDGET (impl),
|
||||||
x, y, &xx, &yy);
|
x, y, &x, &y);
|
||||||
pd->x = xx;
|
pd->x = x;
|
||||||
pd->y = yy;
|
pd->y = y;
|
||||||
|
|
||||||
g_idle_add (file_list_show_popover_in_idle, pd);
|
g_idle_add (file_list_show_popover_in_idle, pd);
|
||||||
}
|
}
|
||||||
|
@ -354,6 +354,7 @@ notify_cursor_location (GtkIMContextWayland *context)
|
|||||||
{
|
{
|
||||||
GtkIMContextWaylandGlobal *global;
|
GtkIMContextWaylandGlobal *global;
|
||||||
cairo_rectangle_int_t rect;
|
cairo_rectangle_int_t rect;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
global = gtk_im_context_wayland_get_global (context);
|
global = gtk_im_context_wayland_get_global (context);
|
||||||
if (global == NULL)
|
if (global == NULL)
|
||||||
@ -363,8 +364,10 @@ notify_cursor_location (GtkIMContextWayland *context)
|
|||||||
gtk_widget_translate_coordinates (context->widget,
|
gtk_widget_translate_coordinates (context->widget,
|
||||||
GTK_WIDGET (gtk_widget_get_root (context->widget)),
|
GTK_WIDGET (gtk_widget_get_root (context->widget)),
|
||||||
rect.x, rect.y,
|
rect.x, rect.y,
|
||||||
&rect.x, &rect.y);
|
&x, &y);
|
||||||
|
|
||||||
|
rect.x = x;
|
||||||
|
rect.y = y;
|
||||||
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
|
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
|
||||||
rect.x, rect.y,
|
rect.x, rect.y,
|
||||||
rect.width, rect.height);
|
rect.width, rect.height);
|
||||||
|
@ -1284,7 +1284,7 @@ translate_event_coordinates (GdkEvent *event,
|
|||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
graphene_point_t p;
|
graphene_point_t p;
|
||||||
double event_x, event_y;
|
double event_x, event_y;
|
||||||
int native_x, native_y;
|
double native_x, native_y;
|
||||||
|
|
||||||
*x = *y = 0;
|
*x = *y = 0;
|
||||||
|
|
||||||
@ -1432,8 +1432,8 @@ update_pointer_focus_state (GtkWindow *toplevel,
|
|||||||
GtkWidget *old_target = NULL;
|
GtkWidget *old_target = NULL;
|
||||||
GdkEventSequence *sequence;
|
GdkEventSequence *sequence;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
gdouble x, y;
|
double x, y;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
device = gdk_event_get_device (event);
|
device = gdk_event_get_device (event);
|
||||||
sequence = gdk_event_get_event_sequence (event);
|
sequence = gdk_event_get_event_sequence (event);
|
||||||
@ -1525,7 +1525,7 @@ handle_pointing_event (GdkEvent *event)
|
|||||||
GdkEventSequence *sequence;
|
GdkEventSequence *sequence;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
double x, y;
|
double x, y;
|
||||||
int native_x, native_y;
|
double native_x, native_y;
|
||||||
GtkWidget *native;
|
GtkWidget *native;
|
||||||
GdkEventType type;
|
GdkEventType type;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ gtk_native_default_get_renderer (GtkNative *self)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_native_default_get_surface_transform (GtkNative *self,
|
gtk_native_default_get_surface_transform (GtkNative *self,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
*x = 0;
|
*x = 0;
|
||||||
*y = 0;
|
*y = 0;
|
||||||
@ -111,8 +111,8 @@ gtk_native_get_renderer (GtkNative *self)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gtk_native_get_surface_transform (GtkNative *self,
|
gtk_native_get_surface_transform (GtkNative *self,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_NATIVE (self));
|
g_return_if_fail (GTK_IS_NATIVE (self));
|
||||||
g_return_if_fail (x != NULL);
|
g_return_if_fail (x != NULL);
|
||||||
|
@ -49,8 +49,8 @@ struct _GtkNativeInterface
|
|||||||
GskRenderer * (* get_renderer) (GtkNative *self);
|
GskRenderer * (* get_renderer) (GtkNative *self);
|
||||||
|
|
||||||
void (* get_surface_transform) (GtkNative *self,
|
void (* get_surface_transform) (GtkNative *self,
|
||||||
int *x,
|
double *x,
|
||||||
int *y);
|
double *y);
|
||||||
|
|
||||||
void (* check_resize) (GtkNative *self);
|
void (* check_resize) (GtkNative *self);
|
||||||
};
|
};
|
||||||
@ -69,8 +69,8 @@ GskRenderer *gtk_native_get_renderer (GtkNative *self);
|
|||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_native_get_surface_transform (GtkNative *self,
|
void gtk_native_get_surface_transform (GtkNative *self,
|
||||||
int *x,
|
double *x,
|
||||||
int *y);
|
double *y);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -1686,8 +1686,6 @@ drag_motion_callback (GtkDropTarget *target,
|
|||||||
|
|
||||||
if (row != NULL)
|
if (row != NULL)
|
||||||
{
|
{
|
||||||
gint dest_y, dest_x;
|
|
||||||
|
|
||||||
g_object_get (row, "order-index", &row_index, NULL);
|
g_object_get (row, "order-index", &row_index, NULL);
|
||||||
g_object_get (sidebar->row_placeholder, "order-index", &row_placeholder_index, NULL);
|
g_object_get (sidebar->row_placeholder, "order-index", &row_placeholder_index, NULL);
|
||||||
/* We order the bookmarks sections based on the bookmark index that we
|
/* We order the bookmarks sections based on the bookmark index that we
|
||||||
@ -1703,9 +1701,9 @@ drag_motion_callback (GtkDropTarget *target,
|
|||||||
row_placeholder_index = row_index;
|
row_placeholder_index = row_index;
|
||||||
gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
|
gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
|
||||||
x, y,
|
x, y,
|
||||||
&dest_x, &dest_y);
|
&x, &y);
|
||||||
|
|
||||||
if (dest_y > sidebar->drag_row_height / 2 && row_index > 0)
|
if (y > sidebar->drag_row_height / 2 && row_index > 0)
|
||||||
row_placeholder_index++;
|
row_placeholder_index++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3459,8 +3457,8 @@ on_row_dragged (GtkGestureDrag *gesture,
|
|||||||
|
|
||||||
if (gtk_drag_check_threshold (GTK_WIDGET (row), 0, 0, x, y))
|
if (gtk_drag_check_threshold (GTK_WIDGET (row), 0, 0, x, y))
|
||||||
{
|
{
|
||||||
gdouble start_x, start_y;
|
double start_x, start_y;
|
||||||
gint drag_x, drag_y;
|
double drag_x, drag_y;
|
||||||
GdkContentProvider *content;
|
GdkContentProvider *content;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
GdkDevice *device;
|
GdkDevice *device;
|
||||||
|
@ -1898,14 +1898,17 @@ on_address_entry_show_help_pressed (GtkPlacesView *view,
|
|||||||
GtkEntry *entry)
|
GtkEntry *entry)
|
||||||
{
|
{
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
/* Setup the auxiliary popover's rectangle */
|
/* Setup the auxiliary popover's rectangle */
|
||||||
gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
|
gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
|
||||||
GTK_ENTRY_ICON_SECONDARY,
|
GTK_ENTRY_ICON_SECONDARY,
|
||||||
&rect);
|
&rect);
|
||||||
gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
|
gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
|
||||||
rect.x, rect.y, &rect.x, &rect.y);
|
rect.x, rect.y, &x, &y);
|
||||||
|
|
||||||
|
rect.x = x;
|
||||||
|
rect.y = y;
|
||||||
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
|
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
|
||||||
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
|
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -218,8 +218,8 @@ gtk_popover_native_get_renderer (GtkNative *native)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_popover_native_get_surface_transform (GtkNative *native,
|
gtk_popover_native_get_surface_transform (GtkNative *native,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
GtkCssBoxes css_boxes;
|
GtkCssBoxes css_boxes;
|
||||||
const graphene_rect_t *margin_rect;
|
const graphene_rect_t *margin_rect;
|
||||||
@ -1212,8 +1212,8 @@ gtk_popover_update_shape (GtkPopover *popover)
|
|||||||
cairo_surface_t *cairo_surface;
|
cairo_surface_t *cairo_surface;
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
int x, y;
|
double x, y;
|
||||||
int native_x, native_y;
|
double native_x, native_y;
|
||||||
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (popover), &native_x, &native_y);
|
gtk_native_get_surface_transform (GTK_NATIVE (popover), &native_x, &native_y);
|
||||||
gtk_css_boxes_init (&content_css_boxes, priv->contents_widget);
|
gtk_css_boxes_init (&content_css_boxes, priv->contents_widget);
|
||||||
|
@ -1806,20 +1806,19 @@ update_initial_slider_position (GtkRange *range,
|
|||||||
double y)
|
double y)
|
||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
int trough_x, trough_y;
|
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
||||||
x, y, &trough_x, &trough_y);
|
x, y, &x, &y);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
{
|
{
|
||||||
priv->slide_initial_slider_position = MAX (0, priv->slider_x);
|
priv->slide_initial_slider_position = MAX (0, priv->slider_x);
|
||||||
priv->slide_initial_coordinate_delta = trough_x - priv->slide_initial_slider_position;
|
priv->slide_initial_coordinate_delta = x - priv->slide_initial_slider_position;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
priv->slide_initial_slider_position = MAX (0, priv->slider_y);
|
priv->slide_initial_slider_position = MAX (0, priv->slider_y);
|
||||||
priv->slide_initial_coordinate_delta = trough_y - priv->slide_initial_slider_position;
|
priv->slide_initial_coordinate_delta = y - priv->slide_initial_slider_position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,7 +1898,7 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
|
|||||||
(!primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
|
(!primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
|
||||||
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
|
(!primary_warps && button == GDK_BUTTON_MIDDLE)))
|
||||||
{
|
{
|
||||||
int slider_range_x, slider_range_y;
|
double slider_range_x, slider_range_y;
|
||||||
graphene_rect_t slider_bounds;
|
graphene_rect_t slider_bounds;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (priv->trough_widget, widget,
|
gtk_widget_translate_coordinates (priv->trough_widget, widget,
|
||||||
@ -1993,9 +1992,10 @@ update_slider_position (GtkRange *range,
|
|||||||
gdouble mark_delta;
|
gdouble mark_delta;
|
||||||
gdouble zoom;
|
gdouble zoom;
|
||||||
gint i;
|
gint i;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
gtk_widget_translate_coordinates (GTK_WIDGET (range), priv->trough_widget,
|
||||||
mouse_x, mouse_y, &mouse_x, &mouse_y);
|
mouse_x, mouse_y, &x, &y);
|
||||||
|
|
||||||
if (priv->zoom &&
|
if (priv->zoom &&
|
||||||
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
|
gtk_widget_compute_bounds (priv->trough_widget, priv->trough_widget, &trough_bounds))
|
||||||
@ -2028,15 +2028,15 @@ update_slider_position (GtkRange *range,
|
|||||||
zoom_divisor = zoom - 1.0;
|
zoom_divisor = zoom - 1.0;
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
priv->slide_initial_slider_position = (zoom * (mouse_y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
|
priv->slide_initial_slider_position = (zoom * (y - priv->slide_initial_coordinate_delta) - slider_bounds.origin.y) / zoom_divisor;
|
||||||
else
|
else
|
||||||
priv->slide_initial_slider_position = (zoom * (mouse_x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
|
priv->slide_initial_slider_position = (zoom * (x - priv->slide_initial_coordinate_delta) - slider_bounds.origin.x) / zoom_divisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
if (priv->orientation == GTK_ORIENTATION_VERTICAL)
|
||||||
delta = mouse_y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
delta = y - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
||||||
else
|
else
|
||||||
delta = mouse_x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
delta = x - (priv->slide_initial_coordinate_delta + priv->slide_initial_slider_position);
|
||||||
|
|
||||||
c = priv->slide_initial_slider_position + zoom * delta;
|
c = priv->slide_initial_slider_position + zoom * delta;
|
||||||
|
|
||||||
@ -2635,18 +2635,19 @@ gtk_range_calc_marks (GtkRange *range)
|
|||||||
{
|
{
|
||||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||||
GdkRectangle slider;
|
GdkRectangle slider;
|
||||||
|
double x, y;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < priv->n_marks; i++)
|
for (i = 0; i < priv->n_marks; i++)
|
||||||
{
|
{
|
||||||
gtk_range_compute_slider_position (range, priv->marks[i], &slider);
|
gtk_range_compute_slider_position (range, priv->marks[i], &slider);
|
||||||
gtk_widget_translate_coordinates (priv->trough_widget, GTK_WIDGET (range),
|
gtk_widget_translate_coordinates (priv->trough_widget, GTK_WIDGET (range),
|
||||||
slider.x, slider.y, &slider.x, &slider.y);
|
slider.x, slider.y, &x, &y);
|
||||||
|
|
||||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||||
priv->mark_pos[i] = slider.x + slider.width / 2;
|
priv->mark_pos[i] = x + slider.width / 2;
|
||||||
else
|
else
|
||||||
priv->mark_pos[i] = slider.y + slider.height / 2;
|
priv->mark_pos[i] = y + slider.height / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ gtk_text_handle_native_get_renderer (GtkNative *native)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_handle_native_get_surface_transform (GtkNative *native,
|
gtk_text_handle_native_get_surface_transform (GtkNative *native,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
GtkCssBoxes css_boxes;
|
GtkCssBoxes css_boxes;
|
||||||
const graphene_rect_t *margin_rect;
|
const graphene_rect_t *margin_rect;
|
||||||
@ -115,6 +115,7 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
|
|||||||
GdkPopupLayout *layout;
|
GdkPopupLayout *layout;
|
||||||
GdkRectangle rect;
|
GdkRectangle rect;
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
gtk_widget_get_preferred_size (widget, NULL, &req);
|
gtk_widget_get_preferred_size (widget, NULL, &req);
|
||||||
gtk_text_handle_get_padding (handle, &handle->border);
|
gtk_text_handle_get_padding (handle, &handle->border);
|
||||||
@ -126,7 +127,9 @@ gtk_text_handle_present_surface (GtkTextHandle *handle)
|
|||||||
|
|
||||||
gtk_widget_translate_coordinates (gtk_widget_get_parent (widget),
|
gtk_widget_translate_coordinates (gtk_widget_get_parent (widget),
|
||||||
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW),
|
gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW),
|
||||||
rect.x, rect.y, &rect.x, &rect.y);
|
rect.x, rect.y, &x, &y);
|
||||||
|
rect.x = x;
|
||||||
|
rect.y = y;
|
||||||
|
|
||||||
if (handle->role == GTK_TEXT_HANDLE_ROLE_CURSOR)
|
if (handle->role == GTK_TEXT_HANDLE_ROLE_CURSOR)
|
||||||
rect.x -= rect.width / 2;
|
rect.x -= rect.width / 2;
|
||||||
|
@ -8618,19 +8618,19 @@ gtk_text_view_do_popup (GtkTextView *text_view,
|
|||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double px, py;
|
double px, py;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
native = gtk_widget_get_native (GTK_WIDGET (text_view));
|
native = gtk_widget_get_native (GTK_WIDGET (text_view));
|
||||||
surface = gtk_native_get_surface (native);
|
surface = gtk_native_get_surface (native);
|
||||||
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
||||||
gtk_native_get_surface_transform (native, &nx, &ny);
|
gtk_native_get_surface_transform (native, &nx, &ny);
|
||||||
rect.x = round (px) - nx;
|
|
||||||
rect.y = round (py) - ny;
|
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (text_view))),
|
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (text_view))),
|
||||||
GTK_WIDGET (text_view),
|
GTK_WIDGET (text_view),
|
||||||
rect.x, rect.y,
|
px - nx, py - ny,
|
||||||
&rect.x, &rect.y);
|
&px, &py);
|
||||||
|
rect.x = px;
|
||||||
|
rect.y = py;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_popover_set_pointing_to (GTK_POPOVER (priv->popup_menu), &rect);
|
gtk_popover_set_pointing_to (GTK_POPOVER (priv->popup_menu), &rect);
|
||||||
|
@ -376,7 +376,6 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
|||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double x, y;
|
double x, y;
|
||||||
GtkWidget *toplevel;
|
GtkWidget *toplevel;
|
||||||
int dx, dy;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
@ -403,9 +402,9 @@ gtk_tooltip_trigger_tooltip_query (GtkWidget *widget)
|
|||||||
if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface)
|
if (gtk_native_get_surface (GTK_NATIVE (toplevel)) != surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (toplevel, widget, round (x), round (y), &dx, &dy);
|
gtk_widget_translate_coordinates (toplevel, widget, x, y, &x, &y);
|
||||||
|
|
||||||
gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, dx, dy);
|
gtk_tooltip_handle_event_internal (GDK_MOTION_NOTIFY, surface, widget, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -426,7 +425,8 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
|
|||||||
{
|
{
|
||||||
GtkWidget *event_widget;
|
GtkWidget *event_widget;
|
||||||
GtkWidget *picked_widget;
|
GtkWidget *picked_widget;
|
||||||
int native_x, native_y;
|
double x, y;
|
||||||
|
double native_x, native_y;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
||||||
|
|
||||||
@ -436,13 +436,16 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (event_widget), &native_x, &native_y);
|
gtk_native_get_surface_transform (GTK_NATIVE (event_widget), &native_x, &native_y);
|
||||||
surface_x -= native_x;
|
x = surface_x - native_x;
|
||||||
surface_y -= native_y;
|
y = surface_y - native_y;
|
||||||
|
|
||||||
picked_widget = gtk_widget_pick (event_widget, surface_x, surface_y, GTK_PICK_INSENSITIVE);
|
picked_widget = gtk_widget_pick (event_widget, x, y, GTK_PICK_INSENSITIVE);
|
||||||
|
|
||||||
if (picked_widget != NULL)
|
if (picked_widget != NULL)
|
||||||
gtk_widget_translate_coordinates (event_widget, picked_widget, surface_x, surface_y, widget_x, widget_y);
|
gtk_widget_translate_coordinates (event_widget, picked_widget, x, y, &x, &y);
|
||||||
|
|
||||||
|
*widget_x = x;
|
||||||
|
*widget_y = y;
|
||||||
|
|
||||||
return picked_widget;
|
return picked_widget;
|
||||||
}
|
}
|
||||||
@ -553,15 +556,23 @@ gtk_tooltip_run_requery (GtkWidget **widget,
|
|||||||
|
|
||||||
if (!return_value)
|
if (!return_value)
|
||||||
{
|
{
|
||||||
GtkWidget *parent = gtk_widget_get_parent (*widget);
|
GtkWidget *parent = gtk_widget_get_parent (*widget);
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
gtk_widget_translate_coordinates (*widget, parent, *x, *y, x, y);
|
{
|
||||||
|
double xx = *x;
|
||||||
|
double yy = *y;
|
||||||
|
|
||||||
*widget = parent;
|
gtk_widget_translate_coordinates (*widget, parent, xx, yy, &xx, &yy);
|
||||||
}
|
|
||||||
|
*x = xx;
|
||||||
|
*y = yy;
|
||||||
|
}
|
||||||
|
|
||||||
|
*widget = parent;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (*widget);
|
while (*widget);
|
||||||
|
|
||||||
@ -588,7 +599,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
|
|||||||
int rect_anchor_dx = 0;
|
int rect_anchor_dx = 0;
|
||||||
int cursor_size;
|
int cursor_size;
|
||||||
int anchor_rect_padding;
|
int anchor_rect_padding;
|
||||||
int native_x, native_y;
|
double native_x, native_y;
|
||||||
|
|
||||||
gtk_widget_realize (GTK_WIDGET (tooltip->window));
|
gtk_widget_realize (GTK_WIDGET (tooltip->window));
|
||||||
|
|
||||||
@ -907,8 +918,7 @@ _gtk_tooltip_handle_event (GtkWidget *target,
|
|||||||
GdkEventType event_type;
|
GdkEventType event_type;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double x, y;
|
double x, y;
|
||||||
int native_x, native_y;
|
double nx, ny;
|
||||||
int tx, ty;
|
|
||||||
GtkWidget *native;
|
GtkWidget *native;
|
||||||
|
|
||||||
if (!tooltips_enabled (event))
|
if (!tooltips_enabled (event))
|
||||||
@ -919,13 +929,9 @@ _gtk_tooltip_handle_event (GtkWidget *target,
|
|||||||
gdk_event_get_position (event, &x, &y);
|
gdk_event_get_position (event, &x, &y);
|
||||||
native = GTK_WIDGET (gtk_widget_get_native (target));
|
native = GTK_WIDGET (gtk_widget_get_native (target));
|
||||||
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
|
gtk_native_get_surface_transform (GTK_NATIVE (native), &nx, &ny);
|
||||||
gtk_widget_translate_coordinates (native, target,
|
gtk_widget_translate_coordinates (native, target, x - nx, y - ny, &x, &y);
|
||||||
x - native_x,
|
gtk_tooltip_handle_event_internal (event_type, surface, target, x, y);
|
||||||
y - native_y,
|
|
||||||
&tx, &ty);
|
|
||||||
|
|
||||||
gtk_tooltip_handle_event_internal (event_type, surface, target, tx, ty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dx/dy must be in @target_widget's coordinates */
|
/* dx/dy must be in @target_widget's coordinates */
|
||||||
@ -933,8 +939,8 @@ static void
|
|||||||
gtk_tooltip_handle_event_internal (GdkEventType event_type,
|
gtk_tooltip_handle_event_internal (GdkEventType event_type,
|
||||||
GdkSurface *surface,
|
GdkSurface *surface,
|
||||||
GtkWidget *target_widget,
|
GtkWidget *target_widget,
|
||||||
gdouble dx,
|
double dx,
|
||||||
gdouble dy)
|
double dy)
|
||||||
{
|
{
|
||||||
int x = dx, y = dy;
|
int x = dx, y = dy;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
@ -94,8 +94,8 @@ gtk_tooltip_window_native_get_renderer (GtkNative *native)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tooltip_window_native_get_surface_transform (GtkNative *native,
|
gtk_tooltip_window_native_get_surface_transform (GtkNative *native,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
GtkCssBoxes css_boxes;
|
GtkCssBoxes css_boxes;
|
||||||
const graphene_rect_t *margin_rect;
|
const graphene_rect_t *margin_rect;
|
||||||
|
@ -648,7 +648,7 @@ focus_change_handler (GtkWidget *widget)
|
|||||||
GtkRoot *root;
|
GtkRoot *root;
|
||||||
GtkWidget *focus_widget;
|
GtkWidget *focus_widget;
|
||||||
graphene_rect_t rect;
|
graphene_rect_t rect;
|
||||||
int x, y;
|
double x, y;
|
||||||
|
|
||||||
if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_FOCUS_WITHIN) == 0)
|
if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_FOCUS_WITHIN) == 0)
|
||||||
return;
|
return;
|
||||||
@ -666,8 +666,8 @@ focus_change_handler (GtkWidget *widget)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (viewport->child, widget,
|
gtk_widget_translate_coordinates (viewport->child, widget,
|
||||||
(int)rect.origin.x,
|
rect.origin.x,
|
||||||
(int)rect.origin.y,
|
rect.origin.y,
|
||||||
&x, &y);
|
&x, &y);
|
||||||
|
|
||||||
scroll_to_view (viewport->hadjustment, x, rect.size.width);
|
scroll_to_view (viewport->hadjustment, x, rect.size.width);
|
||||||
|
@ -3447,7 +3447,7 @@ gtk_widget_get_surface_allocation (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkWidget *parent;
|
GtkWidget *parent;
|
||||||
graphene_rect_t bounds;
|
graphene_rect_t bounds;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
/* Don't consider the parent == widget case here. */
|
/* Don't consider the parent == widget case here. */
|
||||||
parent = _gtk_widget_get_parent (widget);
|
parent = _gtk_widget_get_parent (widget);
|
||||||
@ -4104,10 +4104,10 @@ gtk_widget_common_ancestor (GtkWidget *widget_a,
|
|||||||
gboolean
|
gboolean
|
||||||
gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
||||||
GtkWidget *dest_widget,
|
GtkWidget *dest_widget,
|
||||||
gint src_x,
|
double src_x,
|
||||||
gint src_y,
|
double src_y,
|
||||||
gint *dest_x,
|
double *dest_x,
|
||||||
gint *dest_y)
|
double *dest_y)
|
||||||
{
|
{
|
||||||
graphene_point_t p;
|
graphene_point_t p;
|
||||||
|
|
||||||
@ -4552,7 +4552,7 @@ translate_event_coordinates (GdkEvent *event,
|
|||||||
graphene_point_t p;
|
graphene_point_t p;
|
||||||
double event_x, event_y;
|
double event_x, event_y;
|
||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
*x = *y = 0;
|
*x = *y = 0;
|
||||||
|
|
||||||
@ -11657,7 +11657,7 @@ gtk_widget_render (GtkWidget *widget,
|
|||||||
GtkSnapshot *snapshot;
|
GtkSnapshot *snapshot;
|
||||||
GskRenderer *renderer;
|
GskRenderer *renderer;
|
||||||
GskRenderNode *root;
|
GskRenderNode *root;
|
||||||
int x, y;
|
double x, y;
|
||||||
gint64 before_snapshot = g_get_monotonic_time ();
|
gint64 before_snapshot = g_get_monotonic_time ();
|
||||||
gint64 before_render = 0;
|
gint64 before_render = 0;
|
||||||
|
|
||||||
|
@ -653,10 +653,10 @@ gboolean gtk_widget_is_ancestor (GtkWidget *widget,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
|
||||||
GtkWidget *dest_widget,
|
GtkWidget *dest_widget,
|
||||||
gint src_x,
|
double src_x,
|
||||||
gint src_y,
|
double src_y,
|
||||||
gint *dest_x,
|
double *dest_x,
|
||||||
gint *dest_y);
|
double *dest_y);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_widget_contains (GtkWidget *widget,
|
gboolean gtk_widget_contains (GtkWidget *widget,
|
||||||
|
@ -1931,8 +1931,8 @@ gtk_window_root_set_focus (GtkRoot *root,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_window_native_get_surface_transform (GtkNative *native,
|
gtk_window_native_get_surface_transform (GtkNative *native,
|
||||||
int *x,
|
double *x,
|
||||||
int *y)
|
double *y)
|
||||||
{
|
{
|
||||||
const graphene_rect_t *margin_rect;
|
const graphene_rect_t *margin_rect;
|
||||||
GtkCssBoxes boxes;
|
GtkCssBoxes boxes;
|
||||||
|
@ -224,19 +224,19 @@ do_popup_fallback (GtkWindowHandle *self,
|
|||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
double px, py;
|
double px, py;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
native = gtk_widget_get_native (GTK_WIDGET (self));
|
native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||||
surface = gtk_native_get_surface (native);
|
surface = gtk_native_get_surface (native);
|
||||||
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
||||||
gtk_native_get_surface_transform (native, &nx, &ny);
|
gtk_native_get_surface_transform (native, &nx, &ny);
|
||||||
rect.x = round (px) - nx;
|
|
||||||
rect.y = round (py) - ny;
|
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (self))),
|
gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (self))),
|
||||||
GTK_WIDGET (self),
|
GTK_WIDGET (self),
|
||||||
rect.x, rect.y,
|
px - nx, py - ny,
|
||||||
&rect.x, &rect.y);
|
&px, &py);
|
||||||
|
rect.x = px;
|
||||||
|
rect.y = py;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_popover_set_pointing_to (GTK_POPOVER (self->fallback_menu), &rect);
|
gtk_popover_set_pointing_to (GTK_POPOVER (self->fallback_menu), &rect);
|
||||||
@ -444,8 +444,8 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
|
|||||||
{
|
{
|
||||||
GdkEventSequence *sequence;
|
GdkEventSequence *sequence;
|
||||||
double start_x, start_y;
|
double start_x, start_y;
|
||||||
int native_x, native_y;
|
double native_x, native_y;
|
||||||
int window_x, window_y;
|
double window_x, window_y;
|
||||||
GtkNative *native;
|
GtkNative *native;
|
||||||
GdkSurface *surface;
|
GdkSurface *surface;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ gtk_focus_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
GtkFocusOverlay *self = GTK_FOCUS_OVERLAY (overlay);
|
GtkFocusOverlay *self = GTK_FOCUS_OVERLAY (overlay);
|
||||||
GtkWidget *focus;
|
GtkWidget *focus;
|
||||||
graphene_rect_t bounds;
|
graphene_rect_t bounds;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
if (!GTK_IS_NATIVE (widget))
|
if (!GTK_IS_NATIVE (widget))
|
||||||
return;
|
return;
|
||||||
|
@ -51,7 +51,7 @@ find_widget_at_pointer (GdkDevice *device)
|
|||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
gdk_surface_get_device_position (gtk_native_get_surface (GTK_NATIVE (widget)),
|
gdk_surface_get_device_position (gtk_native_get_surface (GTK_NATIVE (widget)),
|
||||||
device, &x, &y, NULL);
|
device, &x, &y, NULL);
|
||||||
|
@ -157,7 +157,7 @@ gtk_layout_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
GskRenderNode *node,
|
GskRenderNode *node,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
int nx, ny;
|
double nx, ny;
|
||||||
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (widget), &nx, &ny);
|
gtk_native_get_surface_transform (GTK_NATIVE (widget), &nx, &ny);
|
||||||
gtk_snapshot_save (snapshot);
|
gtk_snapshot_save (snapshot);
|
||||||
|
@ -48,7 +48,7 @@ overlay_draw (GtkDrawingArea *da,
|
|||||||
GtkAllocation label_allocation;
|
GtkAllocation label_allocation;
|
||||||
GtkRequisition minimum_size, natural_size;
|
GtkRequisition minimum_size, natural_size;
|
||||||
GtkWidget *label = data;
|
GtkWidget *label = data;
|
||||||
gint x, y;
|
double x, y;
|
||||||
|
|
||||||
cairo_translate (cr, -0.5, -0.5);
|
cairo_translate (cr, -0.5, -0.5);
|
||||||
cairo_set_line_width (cr, 1);
|
cairo_set_line_width (cr, 1);
|
||||||
|
@ -17,7 +17,7 @@ drag_begin (GtkDragSource *source,
|
|||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
GtkAllocation alloc;
|
GtkAllocation alloc;
|
||||||
GdkPaintable *paintable;
|
GdkPaintable *paintable;
|
||||||
int x, y;
|
double x, y;
|
||||||
|
|
||||||
row = gtk_widget_get_ancestor (widget, GTK_TYPE_LIST_BOX_ROW);
|
row = gtk_widget_get_ancestor (widget, GTK_TYPE_LIST_BOX_ROW);
|
||||||
gtk_widget_get_allocation (row, &alloc);
|
gtk_widget_get_allocation (row, &alloc);
|
||||||
|
@ -96,7 +96,7 @@ get_child_position (GtkOverlay *overlay,
|
|||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
GtkWidget *child;
|
GtkWidget *child;
|
||||||
GtkAllocation main_alloc;
|
GtkAllocation main_alloc;
|
||||||
gint x, y;
|
double x, y;
|
||||||
|
|
||||||
child = gtk_overlay_get_child (GTK_OVERLAY (overlay));
|
child = gtk_overlay_get_child (GTK_OVERLAY (overlay));
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
|
|||||||
|
|
||||||
for (x = 0; x < G_N_ELEMENTS (points); x ++)
|
for (x = 0; x < G_N_ELEMENTS (points); x ++)
|
||||||
{
|
{
|
||||||
int px, py;
|
double px, py;
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (self->test_widget, widget,
|
gtk_widget_translate_coordinates (self->test_widget, widget,
|
||||||
points[x].coords.x, points[x].coords.y,
|
points[x].coords.x, points[x].coords.y,
|
||||||
|
@ -13,22 +13,20 @@ start_resize (GtkGestureClick *gesture,
|
|||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
guint button;
|
guint button;
|
||||||
guint32 timestamp;
|
guint32 timestamp;
|
||||||
int xx = x;
|
|
||||||
int yy = y;
|
|
||||||
|
|
||||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||||
|
|
||||||
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
|
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
|
||||||
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
|
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
|
||||||
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
|
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
|
||||||
button = gdk_button_event_get_button (event);
|
button = gdk_button_event_get_button (event);
|
||||||
else
|
else
|
||||||
button = 0;
|
button = 0;
|
||||||
timestamp = gdk_event_get_time (event);
|
timestamp = gdk_event_get_time (event);
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
|
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
|
||||||
xx, yy, &xx, &yy);
|
x, y, &x, &y);
|
||||||
gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface), edge, gdk_event_get_device (event), button, xx, yy, timestamp);
|
gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface), edge, gdk_event_get_device (event), button, x, y, timestamp);
|
||||||
|
|
||||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||||
}
|
}
|
||||||
@ -61,22 +59,20 @@ start_move (GtkGestureClick *gesture,
|
|||||||
GdkEvent *event;
|
GdkEvent *event;
|
||||||
guint button;
|
guint button;
|
||||||
guint32 timestamp;
|
guint32 timestamp;
|
||||||
int xx = x;
|
|
||||||
int yy = y;
|
|
||||||
|
|
||||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||||
|
|
||||||
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
|
surface = gtk_native_get_surface (gtk_widget_get_native (widget));
|
||||||
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
|
event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (gesture));
|
||||||
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
|
if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
|
||||||
button = gdk_button_event_get_button (event);
|
button = gdk_button_event_get_button (event);
|
||||||
else
|
else
|
||||||
button = 0;
|
button = 0;
|
||||||
timestamp = gdk_event_get_time (event);
|
timestamp = gdk_event_get_time (event);
|
||||||
|
|
||||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
|
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
|
||||||
xx, yy, &xx, &yy);
|
x, y, &x, &y);
|
||||||
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface), gdk_event_get_device (event), button, xx, yy, timestamp);
|
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface), gdk_event_get_device (event), button, x, y, timestamp);
|
||||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user