Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
P
phosh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Guido Gunther
phosh
Commits
f14416f2
Commit
f14416f2
authored
Mar 27, 2018
by
Guido Gunther
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell: make rotation a property
so we can easily emit the changes signal
parent
2b9b7413
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
src/phosh.c
src/phosh.c
+70
-0
src/phosh.h
src/phosh.h
+1
-0
No files found.
src/phosh.c
View file @
f14416f2
...
...
@@ -24,6 +24,13 @@
#include "favorites.h"
#include "settings.h"
enum
{
PHOSH_SHELL_PROP_0
,
PHOSH_SHELL_PROP_ROTATION
,
PHOSH_SHELL_PROP_LAST_PROP
};
static
GParamSpec
*
props
[
PHOSH_SHELL_PROP_LAST_PROP
];
struct
elem
{
GtkWidget
*
window
;
struct
wl_surface
*
surface
;
...
...
@@ -379,6 +386,47 @@ static const struct wl_registry_listener registry_listener = {
};
static
void
phosh_shell_set_property
(
GObject
*
object
,
guint
property_id
,
const
GValue
*
value
,
GParamSpec
*
pspec
)
{
PhoshShell
*
self
=
PHOSH_SHELL
(
object
);
PhoshShellPrivate
*
priv
=
phosh_shell_get_instance_private
(
self
);
switch
(
property_id
)
{
case
PHOSH_SHELL_PROP_ROTATION
:
priv
->
rotation
=
g_value_get_uint
(
value
);
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
property_id
,
pspec
);
break
;
}
}
static
void
phosh_shell_get_property
(
GObject
*
object
,
guint
property_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
PhoshShell
*
self
=
PHOSH_SHELL
(
object
);
PhoshShellPrivate
*
priv
=
phosh_shell_get_instance_private
(
self
);
switch
(
property_id
)
{
case
PHOSH_SHELL_PROP_ROTATION
:
g_value_set_uint
(
value
,
priv
->
rotation
);
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
property_id
,
pspec
);
break
;
}
}
static
void
phosh_shell_constructed
(
GObject
*
object
)
{
...
...
@@ -425,6 +473,18 @@ phosh_shell_class_init (PhoshShellClass *klass)
GObjectClass
*
object_class
=
G_OBJECT_CLASS
(
klass
);
object_class
->
constructed
=
phosh_shell_constructed
;
object_class
->
set_property
=
phosh_shell_set_property
;
object_class
->
get_property
=
phosh_shell_get_property
;
props
[
PHOSH_SHELL_PROP_ROTATION
]
=
g_param_spec_string
(
"rotation"
,
"Rotation"
,
"Clockwise display rotation in degree"
,
""
,
G_PARAM_READABLE
|
G_PARAM_EXPLICIT_NOTIFY
);
g_object_class_install_properties
(
object_class
,
PHOSH_SHELL_PROP_LAST_PROP
,
props
);
}
...
...
@@ -434,15 +494,25 @@ phosh_shell_init (PhoshShell *self)
}
gint
phosh_shell_get_rotation
(
PhoshShell
*
self
)
{
PhoshShellPrivate
*
priv
=
phosh_shell_get_instance_private
(
self
);
return
priv
->
rotation
;
}
void
phosh_shell_rotate_display
(
PhoshShell
*
self
,
guint
degree
)
{
PhoshShellPrivate
*
priv
=
phosh_shell_get_instance_private
(
self
);
priv
->
rotation
=
degree
;
phosh_mobile_shell_rotate_display
(
priv
->
mshell
,
priv
->
panel
->
surface
,
degree
);
g_object_notify_by_pspec
(
G_OBJECT
(
self
),
props
[
PHOSH_SHELL_PROP_ROTATION
]);
}
...
...
src/phosh.h
View file @
f14416f2
...
...
@@ -16,5 +16,6 @@ G_DECLARE_FINAL_TYPE (PhoshShell, phosh_shell, PHOSH, SHELL, GObject)
PhoshShell
*
phosh
(
void
);
void
phosh_shell_rotate_display
(
PhoshShell
*
self
,
guint
degrees
);
int
phosh_shell_get_rotation
(
PhoshShell
*
self
);
#endif
/* PHOSH_H */
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