[mutter/wip/dnd-surface: 2/4] hot offs
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/dnd-surface: 2/4] hot offs
- Date: Mon, 1 Sep 2014 21:35:23 +0000 (UTC)
commit 074946ac0b09bba2b4d1e9c8fe2ee850ffcfca24
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Aug 21 17:57:28 2014 -0400
hot offs
src/backends/meta-cursor-private.h | 10 ++++----
src/backends/meta-cursor-renderer.c | 8 +++---
src/backends/meta-cursor-tracker.c | 16 +++++++++----
src/backends/meta-cursor.c | 24 ++++++++++----------
src/backends/meta-cursor.h | 3 +-
src/backends/native/meta-cursor-renderer-native.c | 6 ++--
6 files changed, 36 insertions(+), 31 deletions(-)
---
diff --git a/src/backends/meta-cursor-private.h b/src/backends/meta-cursor-private.h
index 09ab992..9061e53 100644
--- a/src/backends/meta-cursor-private.h
+++ b/src/backends/meta-cursor-private.h
@@ -30,7 +30,7 @@
typedef struct {
CoglTexture2D *texture;
struct gbm_bo *bo;
- int hot_x, hot_y;
+ int offset_x, offset_y;
} MetaCursorImage;
struct _MetaCursorReference {
@@ -41,11 +41,11 @@ struct _MetaCursorReference {
};
CoglTexture *meta_cursor_reference_get_cogl_texture (MetaCursorReference *cursor,
- int *hot_x,
- int *hot_y);
+ int *offset_x,
+ int *offset_y);
struct gbm_bo *meta_cursor_reference_get_gbm_bo (MetaCursorReference *cursor,
- int *hot_x,
- int *hot_y);
+ int *offset_x,
+ int *offset_y);
#endif /* META_CURSOR_PRIVATE_H */
diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c
index 176e6af..10f3b3d 100644
--- a/src/backends/meta-cursor-renderer.c
+++ b/src/backends/meta-cursor-renderer.c
@@ -94,12 +94,12 @@ update_cursor (MetaCursorRenderer *renderer)
if (priv->displayed_cursor)
{
CoglTexture *texture;
- int hot_x, hot_y;
+ int offset_x, offset_y;
- texture = meta_cursor_reference_get_cogl_texture (priv->displayed_cursor, &hot_x, &hot_y);
+ texture = meta_cursor_reference_get_cogl_texture (priv->displayed_cursor, &offset_x, &offset_y);
- priv->current_rect.x = priv->current_x - hot_x;
- priv->current_rect.y = priv->current_y - hot_y;
+ priv->current_rect.x = priv->current_x + offset_x;
+ priv->current_rect.y = priv->current_y + offset_y;
priv->current_rect.width = cogl_texture_get_width (COGL_TEXTURE (texture));
priv->current_rect.height = cogl_texture_get_height (COGL_TEXTURE (texture));
}
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index a649cb4..83999e5 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -310,6 +310,7 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
int *y)
{
MetaCursorReference *cursor;
+ int offset_x, offset_y;
g_return_if_fail (META_IS_CURSOR_TRACKER (tracker));
@@ -324,14 +325,19 @@ meta_cursor_tracker_get_hot (MetaCursorTracker *tracker,
}
if (cursor)
- meta_cursor_reference_get_cogl_texture (cursor, x, y);
+ {
+ meta_cursor_reference_get_cogl_texture (cursor, &offset_x, &offset_y);
+ }
else
{
- if (x)
- *x = 0;
- if (y)
- *y = 0;
+ offset_x = 0;
+ offset_y = 0;
}
+
+ if (x)
+ *x = -offset_x;
+ if (y)
+ *y = -offset_y;
}
void
diff --git a/src/backends/meta-cursor.c b/src/backends/meta-cursor.c
index 592e26f..66f031d 100644
--- a/src/backends/meta-cursor.c
+++ b/src/backends/meta-cursor.c
@@ -352,25 +352,25 @@ meta_cursor_reference_from_buffer (struct wl_resource *buffer,
CoglTexture *
meta_cursor_reference_get_cogl_texture (MetaCursorReference *cursor,
- int *hot_x,
- int *hot_y)
+ int *offset_x,
+ int *offset_y)
{
- if (hot_x)
- *hot_x = cursor->image.hot_x;
- if (hot_y)
- *hot_y = cursor->image.hot_y;
+ if (offset_x)
+ *offset_x = cursor->image.offset_x;
+ if (offset_y)
+ *offset_y = cursor->image.offset_y;
return COGL_TEXTURE (cursor->image.texture);
}
struct gbm_bo *
meta_cursor_reference_get_gbm_bo (MetaCursorReference *cursor,
- int *hot_x,
- int *hot_y)
+ int *offset_x,
+ int *offset_y)
{
- if (hot_x)
- *hot_x = cursor->image.hot_x;
- if (hot_y)
- *hot_y = cursor->image.hot_y;
+ if (offset_x)
+ *offset_x = cursor->image.offset_x;
+ if (offset_y)
+ *offset_y = cursor->image.offset_y;
return cursor->image.bo;
}
diff --git a/src/backends/meta-cursor.h b/src/backends/meta-cursor.h
index b627dc0..1cd28d0 100644
--- a/src/backends/meta-cursor.h
+++ b/src/backends/meta-cursor.h
@@ -34,8 +34,7 @@ MetaCursorReference * meta_cursor_reference_from_theme (MetaCursor cur
#ifdef HAVE_WAYLAND
#include <wayland-server.h>
MetaCursorReference * meta_cursor_reference_from_buffer (struct wl_resource *buffer,
- int hot_x,
- int hot_y);
+ int offset_x, int offset_y);
#endif
MetaCursor meta_cursor_reference_get_meta_cursor (MetaCursorReference *cursor);
diff --git a/src/backends/native/meta-cursor-renderer-native.c
b/src/backends/native/meta-cursor-renderer-native.c
index 883ddef..9f97fde 100644
--- a/src/backends/native/meta-cursor-renderer-native.c
+++ b/src/backends/native/meta-cursor-renderer-native.c
@@ -72,16 +72,16 @@ set_crtc_cursor (MetaCursorRendererNative *native,
struct gbm_bo *bo;
union gbm_bo_handle handle;
int width, height;
- int hot_x, hot_y;
+ int offset_x, offset_y;
- bo = meta_cursor_reference_get_gbm_bo (cursor, &hot_x, &hot_y);
+ bo = meta_cursor_reference_get_gbm_bo (cursor, &offset_x, &offset_y);
handle = gbm_bo_get_handle (bo);
width = gbm_bo_get_width (bo);
height = gbm_bo_get_height (bo);
drmModeSetCursor2 (priv->drm_fd, crtc->crtc_id, handle.u32,
- width, height, hot_x, hot_y);
+ width, height, -offset_x, -offset_y);
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]