Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gtk
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1,146
Issues
1,146
List
Boards
Labels
Milestones
Merge Requests
99
Merge Requests
99
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gtk
Commits
28b2d7e5
Commit
28b2d7e5
authored
Dec 20, 2010
by
Benjamin Otte
Committed by
Matthias Clasen
Dec 21, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdk: Make cursor-type a property of the cursor
parent
3e068e92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
23 deletions
+72
-23
gdk/gdkcursor.c
gdk/gdkcursor.c
+56
-0
gdk/x11/gdkcursor-x11.c
gdk/x11/gdkcursor-x11.c
+16
-23
No files found.
gdk/gdkcursor.c
View file @
28b2d7e5
...
...
@@ -29,6 +29,7 @@
#include "gdkcursor.h"
#include "gdkcursorprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkintl.h"
#include "gdkinternals.h"
...
...
@@ -59,11 +60,66 @@
* The #GdkCursor structure represents a cursor. Its contents are private.
*/
enum
{
PROP_0
,
PROP_CURSOR_TYPE
};
G_DEFINE_ABSTRACT_TYPE
(
GdkCursor
,
gdk_cursor
,
G_TYPE_OBJECT
)
static
void
gdk_cursor_get_property
(
GObject
*
object
,
guint
prop_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
GdkCursor
*
cursor
=
GDK_CURSOR
(
object
);
switch
(
prop_id
)
{
case
PROP_CURSOR_TYPE
:
g_value_set_enum
(
value
,
cursor
->
type
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
prop_id
,
pspec
);
break
;
}
}
static
void
gdk_cursor_set_property
(
GObject
*
object
,
guint
prop_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
{
GdkCursor
*
cursor
=
GDK_CURSOR
(
object
);
switch
(
prop_id
)
{
case
PROP_CURSOR_TYPE
:
cursor
->
type
=
g_value_get_enum
(
value
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
prop_id
,
pspec
);
break
;
}
}
static
void
gdk_cursor_class_init
(
GdkCursorClass
*
cursor_class
)
{
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
cursor_class
);
object_class
->
get_property
=
gdk_cursor_get_property
;
object_class
->
set_property
=
gdk_cursor_set_property
;
g_object_class_install_property
(
object_class
,
PROP_CURSOR_TYPE
,
g_param_spec_enum
(
"cursor-type"
,
P_
(
"Cursor type"
),
P_
(
"Standard cursor type"
),
GDK_TYPE_CURSOR_TYPE
,
GDK_X_CURSOR
,
G_PARAM_READWRITE
|
G_PARAM_CONSTRUCT_ONLY
));
}
static
void
...
...
gdk/x11/gdkcursor-x11.c
View file @
28b2d7e5
...
...
@@ -247,7 +247,6 @@ _gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType
cursor_type
)
{
GdkX11Cursor
*
private
;
GdkCursor
*
cursor
;
Cursor
xcursor
;
if
(
gdk_display_is_closed
(
display
))
...
...
@@ -275,19 +274,18 @@ _gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
}
}
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
NULL
);
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
"cursor-type"
,
GDK_CURSOR_IS_PIXMAP
,
NULL
);
private
->
display
=
display
;
private
->
xcursor
=
xcursor
;
private
->
name
=
NULL
;
private
->
serial
=
theme_serial
;
cursor
=
(
GdkCursor
*
)
private
;
cursor
->
type
=
cursor_type
;
if
(
xcursor
!=
None
)
add_to_cache
(
private
);
return
cursor
;
return
GDK_CURSOR
(
private
)
;
}
/**
...
...
@@ -599,7 +597,6 @@ _gdk_x11_display_get_cursor_for_pixbuf (GdkDisplay *display,
XcursorImage
*
xcimage
;
Cursor
xcursor
;
GdkX11Cursor
*
private
;
GdkCursor
*
cursor
;
const
char
*
option
;
char
*
end
;
gint64
value
;
...
...
@@ -639,16 +636,15 @@ _gdk_x11_display_get_cursor_for_pixbuf (GdkDisplay *display,
XcursorImageDestroy
(
xcimage
);
}
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
NULL
);
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
"cursor-type"
,
GDK_CURSOR_IS_PIXMAP
,
NULL
);
private
->
display
=
display
;
private
->
xcursor
=
xcursor
;
private
->
name
=
NULL
;
private
->
serial
=
theme_serial
;
cursor
=
(
GdkCursor
*
)
private
;
cursor
->
type
=
GDK_CURSOR_IS_PIXMAP
;
return
cursor
;
return
GDK_CURSOR
(
private
);
}
GdkCursor
*
...
...
@@ -658,7 +654,6 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
Cursor
xcursor
;
Display
*
xdisplay
;
GdkX11Cursor
*
private
;
GdkCursor
*
cursor
;
if
(
gdk_display_is_closed
(
display
))
{
...
...
@@ -682,17 +677,17 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
return
NULL
;
}
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
NULL
);
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
"cursor-type"
,
GDK_CURSOR_IS_PIXMAP
,
NULL
);
private
->
display
=
display
;
private
->
xcursor
=
xcursor
;
private
->
name
=
g_strdup
(
name
);
private
->
serial
=
theme_serial
;
cursor
=
(
GdkCursor
*
)
private
;
cursor
->
type
=
GDK_CURSOR_IS_PIXMAP
;
add_to_cache
(
private
);
return
cursor
;
return
GDK_CURSOR
(
private
)
;
}
gboolean
...
...
@@ -727,7 +722,6 @@ gdk_cursor_new_from_pixmap (GdkDisplay *display,
gint
y
)
{
GdkX11Cursor
*
private
;
GdkCursor
*
cursor
;
Cursor
xcursor
;
XColor
xfg
,
xbg
;
...
...
@@ -748,16 +742,15 @@ gdk_cursor_new_from_pixmap (GdkDisplay *display,
else
xcursor
=
XCreatePixmapCursor
(
GDK_DISPLAY_XDISPLAY
(
display
),
source_pixmap
,
mask_pixmap
,
&
xfg
,
&
xbg
,
x
,
y
);
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
NULL
);
private
=
g_object_new
(
GDK_TYPE_X11_CURSOR
,
"cursor-type"
,
GDK_CURSOR_IS_PIXMAP
,
NULL
);
private
->
display
=
display
;
private
->
xcursor
=
xcursor
;
private
->
name
=
NULL
;
private
->
serial
=
theme_serial
;
cursor
=
(
GdkCursor
*
)
private
;
cursor
->
type
=
GDK_CURSOR_IS_PIXMAP
;
return
cursor
;
return
GDK_CURSOR
(
private
);
}
GdkCursor
*
...
...
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