Merge lp:~azzar1/unity/fix-highdpi-force-quit-dialog into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4203
Proposed branch: lp:~azzar1/unity/fix-highdpi-force-quit-dialog
Merge into: lp:unity
Diff against target: 17 lines (+4/-2)
1 file modified
decorations/DecorationsForceQuitDialog.cpp (+4/-2)
To merge this branch: bzr merge lp:~azzar1/unity/fix-highdpi-force-quit-dialog
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+309672@code.launchpad.net

Commit message

Correctly position the force quit dialog when scaling is different than 1.0

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
2--- decorations/DecorationsForceQuitDialog.cpp 2016-08-06 16:24:55 +0000
3+++ decorations/DecorationsForceQuitDialog.cpp 2016-10-31 14:33:59 +0000
4@@ -478,9 +478,11 @@
5
6 void UpdateDialogPosition()
7 {
8+ gint scale = gtk_widget_get_scale_factor(dialog_);
9+ scale = std::max<gint>(1, scale);
10 auto const& win_geo = win_->inputRect();
11- nux::Size walloc(gtk_widget_get_allocated_width(dialog_), gtk_widget_get_allocated_height(dialog_));
12- gtk_window_move(GTK_WINDOW(dialog_), win_geo.centerX() - walloc.width/2, win_geo.centerY() - walloc.height/2);
13+ nux::Size walloc(gtk_widget_get_allocated_width(dialog_) * scale, gtk_widget_get_allocated_height(dialog_) * scale);
14+ gtk_window_move(GTK_WINDOW(dialog_), (win_geo.centerX() - walloc.width/2) / scale, (win_geo.centerY() - walloc.height/2) / scale);
15 }
16
17 ForceQuitDialog* parent_;