mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 18:40:40 -05:00
79c86ae890
This commits refactors cursor handling code and plugs in logic so that cursor sprites changes appearance as it moves across the screen. Renderers are adapted to handle the necessary functionality. The logic for changing the cursor sprite appearance is done outside of MetaCursorSprite, and actually where depends on what type of cursor it is. In mutter we now have two types of cursors that may have their appearance changed: - Themed cursors (aka root cursors) - wl_surface cursors Themed cursors are created by MetaScreen and when created, when applicable(*), it will extend the cursor via connecting to a signal which is emitted everytime the cursor is moved. The signal handler will calculate the expected scale given the monitor it is on and reload the theme in a correct size when needed. wl_surface cursors are created when a wl_surface is assigned the "cursor" role, i.e. when a client calls wl_pointer.set_cursor. A cursor role object is created which is connected to the cursor object by the position signal, and will set a correct texture scale given what monitor the cursor is on and what scale the wl_surface's active buffer is in. It will also push new buffers to the same to the cursor object when new ones are committed to the surface. This commit also makes texture loading lazy, since the renderer doesn't calculate a rectangle when the cursor position changes. The native backend is refactored to be triple-buffered; see the comment in meta-cursor-renderer-native.c for further explanations. * when we are running as a Wayland compositor https://bugzilla.gnome.org/show_bug.cgi?id=744932
76 lines
2.8 KiB
C
76 lines
2.8 KiB
C
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
/*
|
|
* Copyright 2013 Red Hat, Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* This program 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
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* Author: Giovanni Campagna <gcampagn@redhat.com>
|
|
*/
|
|
|
|
#ifndef META_CURSOR_H
|
|
#define META_CURSOR_H
|
|
|
|
#include <meta/common.h>
|
|
#include <meta/boxes.h>
|
|
|
|
typedef struct _MetaCursorSprite MetaCursorSprite;
|
|
|
|
#define META_TYPE_CURSOR_SPRITE (meta_cursor_sprite_get_type ())
|
|
G_DECLARE_FINAL_TYPE (MetaCursorSprite,
|
|
meta_cursor_sprite,
|
|
META, CURSOR_SPRITE,
|
|
GObject);
|
|
|
|
MetaCursorSprite * meta_cursor_sprite_new (void);
|
|
|
|
MetaCursorSprite * meta_cursor_sprite_from_theme (MetaCursor cursor);
|
|
|
|
|
|
void meta_cursor_sprite_set_theme_scale (MetaCursorSprite *self,
|
|
int scale);
|
|
|
|
MetaCursor meta_cursor_sprite_get_meta_cursor (MetaCursorSprite *self);
|
|
|
|
Cursor meta_cursor_create_x_cursor (Display *xdisplay,
|
|
MetaCursor cursor);
|
|
|
|
void meta_cursor_sprite_prepare_at (MetaCursorSprite *self,
|
|
int x,
|
|
int y);
|
|
|
|
void meta_cursor_sprite_realize_texture (MetaCursorSprite *self);
|
|
|
|
void meta_cursor_sprite_set_texture (MetaCursorSprite *self,
|
|
CoglTexture *texture,
|
|
int hot_x,
|
|
int hot_y);
|
|
|
|
void meta_cursor_sprite_set_texture_scale (MetaCursorSprite *self,
|
|
float scale);
|
|
|
|
CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *self);
|
|
|
|
void meta_cursor_sprite_get_hotspot (MetaCursorSprite *self,
|
|
int *hot_x,
|
|
int *hot_y);
|
|
|
|
float meta_cursor_sprite_get_texture_scale (MetaCursorSprite *self);
|
|
|
|
gboolean meta_cursor_sprite_is_animated (MetaCursorSprite *self);
|
|
void meta_cursor_sprite_tick_frame (MetaCursorSprite *self);
|
|
guint meta_cursor_sprite_get_current_frame_time (MetaCursorSprite *self);
|
|
|
|
#endif /* META_CURSOR_H */
|