Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Panel Plugins
xfce4-docklike-plugin
Commits
3004bc34
Commit
3004bc34
authored
Nov 24, 2021
by
Artyom Zorin
Committed by
David Keogh
Nov 28, 2021
Browse files
Anchor group menu to center of app icon
parent
091441e5
Pipeline
#12315
passed with stages
in 2 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/GroupMenu.cpp
View file @
3004bc34
...
...
@@ -98,7 +98,7 @@ void GroupMenu::popup()
});
xfce_panel_plugin_position_widget
(
Plugin
::
mXfPlugin
,
mWindow
,
mGroup
->
mButton
,
&
wx
,
&
wy
);
gtk_window_move
(
GTK_WINDOW
(
mWindow
),
wx
,
wy
);
updatePosition
(
wx
,
wy
);
gtk_widget_show
(
mWindow
);
}
}
...
...
@@ -113,6 +113,42 @@ void GroupMenu::updateOrientation()
gtk_orientable_set_orientation
(
GTK_ORIENTABLE
(
mBox
),
GTK_ORIENTATION_VERTICAL
);
}
void
GroupMenu
::
updatePosition
(
gint
wx
,
gint
wy
)
{
GdkScreen
*
screen
;
GdkRectangle
geometry
;
GdkDisplay
*
display
;
GdkMonitor
*
monitor
;
screen
=
gtk_widget_get_screen
(
mGroup
->
mButton
);
display
=
gdk_screen_get_display
(
screen
);
monitor
=
gdk_display_get_monitor_at_window
(
display
,
gtk_widget_get_window
(
mGroup
->
mButton
));
gdk_monitor_get_geometry
(
monitor
,
&
geometry
);
gint
window_width
,
window_height
;
gtk_window_get_size
(
GTK_WINDOW
(
mWindow
),
&
window_width
,
&
window_height
);
gint
button_width
=
gtk_widget_get_allocated_width
(
mGroup
->
mButton
);
gint
button_height
=
gtk_widget_get_allocated_height
(
mGroup
->
mButton
);
XfcePanelPluginMode
panelMode
=
xfce_panel_plugin_get_mode
(
Plugin
::
mXfPlugin
);
if
(
panelMode
==
XFCE_PANEL_PLUGIN_MODE_HORIZONTAL
)
{
if
(
wx
!=
geometry
.
x
+
geometry
.
width
-
window_width
)
{
wx
-=
(
window_width
/
2
)
-
(
button_width
/
2
);
wx
=
wx
<
geometry
.
x
?
geometry
.
x
:
wx
;
}
}
else
{
if
(
wy
!=
geometry
.
y
+
geometry
.
height
-
window_height
)
{
wy
-=
(
window_height
/
2
)
-
(
button_height
/
2
);
wy
=
wy
<
geometry
.
y
?
geometry
.
y
:
wy
;
}
}
gtk_window_move
(
GTK_WINDOW
(
mWindow
),
wx
,
wy
);
}
void
GroupMenu
::
hide
()
{
mVisible
=
false
;
...
...
src/GroupMenu.hpp
View file @
3004bc34
...
...
@@ -25,6 +25,7 @@ class GroupMenu
void
popup
();
void
updateOrientation
();
void
updatePosition
(
gint
wx
,
gint
wy
);
void
hide
();
uint
getPointerDistance
();
...
...
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