elementary / switchboard-plug-display

Switchboard Displays Plug
https://elementary.io
GNU General Public License v3.0
14 stars 18 forks source link

Properly center rotated display widgets #216

Closed felix-andreas closed 4 years ago

felix-andreas commented 4 years ago

Currently the monitor widgets are not properly centered if one of the monitors is rotated. This makes it difficult to adjust the monitor configurations as the monitor controls get somtimes rendered outside of the canvas.

Using the attributes real_width and real_height from the DisplayWidget instead of get_current_mode_size of the VirtualMonitor fixes this problem.

Before:

before

After:

after

felix-andreas commented 4 years ago

@ryonakano I have implemented your suggestion to use properties instead of plain attributes. Just out of curiosity, (apart from that they are read only now) what is the advantage to use properties here?

Because properties are not allow for out-method arguments, I had to use the value holding _real_width and _real_height for the

get_current_mode_size (out _real_width, out _real_height)

method.

Is this best practice? Or would would it be better to use intermediate variables:

int tmp_width, tmp_height;
virtual_monitor.get_current_mode_size (out tmp_width, out tmp_height)
real_width  = tmp_width;
real_height = tmp_height;
ryonakano commented 4 years ago

The one reason I suggested to use properties here is to make these values read-only. And my bad, my suggestion might be wrong. I think we can use intermediate variables or left them public instead.

felix-andreas commented 4 years ago

Ok, I see. Still, thanks for the suggestion!

Maybe someone with more vala knowledge could assist on finding the most elegant solution?