Merge lp:~markodolar/screenshot-tool/screenshot-tool into lp:~elementary-apps/screenshot-tool/trunk

Proposed by MarkoD
Status: Merged
Approved by: Zisu Andrei
Approved revision: 249
Merged at revision: 248
Proposed branch: lp:~markodolar/screenshot-tool/screenshot-tool
Merge into: lp:~elementary-apps/screenshot-tool/trunk
Diff against target: 13 lines (+3/-0)
1 file modified
src/ScreenshotWindow.vala (+3/-0)
To merge this branch: bzr merge lp:~markodolar/screenshot-tool/screenshot-tool
Reviewer Review Type Date Requested Status
Zisu Andrei (community) code and functionality Approve
Review via email: mp+310711@code.launchpad.net

Commit message

Listen to structure events

Description of the change

Screenshot Tool didn't receive updates when other windows were resized. This branch adds event mask to all windows so that program receives size (and some other) updates.

More details - if i understood gdk source correctly:
When querying windows first time Window objects are created and Gdk stores them internally. After that they didn't receive any geometry updates. And when you use window get_width() or get_height() you get old values from that internal Gdk list, not directly from X.

To post a comment you must log in.
Revision history for this message
Zisu Andrei (matzipan) wrote :

I confirm this branch fixes the issue, and cannot find any obvious regressions.

There's a comment inline.

review: Needs Fixing
Revision history for this message
Adam Bieńkowski (donadigo) wrote :

Please use lower cases for variables:
instead of "wantedMask" do "wanted_mask", I would also change it for something like "final_mask".

Revision history for this message
MarkoD (markodolar) wrote :

You are right Andrei, i could probably just set events directly. I was just
trying to be on safe side and set only once for each window because i do
not know the cost of set_events method. Will fix it.

Adam thanks for comment, but looks like i won't be needing variables at all
after fix. :) But i know now for next time..

On Sat, 12 Nov 2016 at 23:59 Adam Bieńkowski <email address hidden> wrote:

> Please use lower cases for variables:
> instead of "wantedMask" do "wanted_mask", I would also change it for
> something like "final_mask".
> --
>
> https://code.launchpad.net/~markodolar/screenshot-tool/screenshot-tool/+merge/310711
> You are the owner of lp:~markodolar/screenshot-tool/screenshot-tool.
>

249. By MarkoD

Set events directly without checking if they are already set.

Revision history for this message
Zisu Andrei (matzipan) :
review: Approve (code and functionality)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ScreenshotWindow.vala'
2--- src/ScreenshotWindow.vala 2016-10-06 20:27:33 +0000
3+++ src/ScreenshotWindow.vala 2016-11-12 23:23:06 +0000
4@@ -400,6 +400,9 @@
5 if (screen.get_active_window () == item) {
6 win = item;
7 }
8+
9+ // Recieve updates of other windows when they are resized
10+ item.set_events (item.get_events () | Gdk.EventMask.STRUCTURE_MASK);
11 }
12
13 this.present ();

Subscribers

People subscribed via source and target branches

to all changes: