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
e7c0eadb
Commit
e7c0eadb
authored
Mar 28, 2018
by
Guido Gunther
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell: allow to query the area usable by wayland clients
This is currently the display size excluding the static panel
parent
2b6064b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
src/phosh.c
src/phosh.c
+37
-0
src/phosh.h
src/phosh.h
+5
-0
No files found.
src/phosh.c
View file @
e7c0eadb
...
...
@@ -516,6 +516,43 @@ phosh_shell_rotate_display (PhoshShell *self,
}
/**
* Returns the usable area in pixels usable by a client on the phone
* display
*/
void
phosh_shell_get_usable_area
(
PhoshShell
*
self
,
gint
*
x
,
gint
*
y
,
gint
*
width
,
gint
*
height
)
{
PhoshShellPrivate
*
priv
=
phosh_shell_get_instance_private
(
self
);
GdkDisplay
*
display
=
gdk_display_get_default
();
/* There's no primary monitor on nested wayland so just use the
first one for now */
GdkMonitor
*
monitor
=
gdk_display_get_monitor
(
display
,
0
);
GdkRectangle
geom
;
gint
panel_height
;
g_return_if_fail
(
monitor
);
g_return_if_fail
(
priv
->
panel
);
g_return_if_fail
(
priv
->
panel
->
window
);
gdk_monitor_get_geometry
(
monitor
,
&
geom
);
panel_height
=
phosh_panel_get_height
(
PHOSH_PANEL
(
priv
->
panel
->
window
));
/* GDK fails to take rotation into account
* https://bugzilla.gnome.org/show_bug.cgi?id=793618 */
if
(
priv
->
rotation
!=
90
&&
priv
->
rotation
!=
270
)
{
*
width
=
geom
.
width
;
*
height
=
geom
.
height
-
panel_height
;
}
else
{
*
width
=
geom
.
height
;
*
height
=
geom
.
width
-
panel_height
;
}
*
x
=
0
;
*
y
=
panel_height
;
}
PhoshShell
*
phosh
()
{
...
...
src/phosh.h
View file @
e7c0eadb
...
...
@@ -17,5 +17,10 @@ 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
);
void
phosh_shell_get_usable_area
(
PhoshShell
*
self
,
gint
*
x
,
gint
*
y
,
gint
*
width
,
gint
*
height
);
#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