Skip to content

Commit

Permalink
Cleanup InternalUtils.set_input_area (#2166)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored Dec 19, 2024
1 parent e6e6a4c commit b80927a
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,24 @@ namespace Gala {
}

X.Xrectangle[] rects = {};
int width, height;
display.get_size (out width, out height);
var geometry = display.get_monitor_geometry (display.get_primary_monitor ());

switch (area) {
case InputArea.FULLSCREEN:
int width, height;
display.get_size (out width, out height);

X.Xrectangle rect = {0, 0, (ushort)width, (ushort)height};
rects = {rect};
break;
case InputArea.DEFAULT:
var settings = new GLib.Settings ("io.elementary.desktop.wm.behavior");

// if ActionType is NONE make it 0 sized
ushort tl_size = (settings.get_enum ("hotcorner-topleft") != ActionType.NONE ? 1 : 0);
ushort tr_size = (settings.get_enum ("hotcorner-topright") != ActionType.NONE ? 1 : 0);
ushort bl_size = (settings.get_enum ("hotcorner-bottomleft") != ActionType.NONE ? 1 : 0);
ushort br_size = (settings.get_enum ("hotcorner-bottomright") != ActionType.NONE ? 1 : 0);

X.Xrectangle topleft = {(short)geometry.x, (short)geometry.y, tl_size, tl_size};
X.Xrectangle topright = {(short)(geometry.x + geometry.width - 1), (short)geometry.y, tr_size, tr_size};
X.Xrectangle bottomleft = {(short)geometry.x, (short)(geometry.y + geometry.height - 1), bl_size, bl_size};
X.Xrectangle bottomright = {(short)(geometry.x + geometry.width - 1), (short)(geometry.y + geometry.height - 1), br_size, br_size};

rects = {topleft, topright, bottomleft, bottomright};

case InputArea.DEFAULT:
// add plugin's requested areas
foreach (var rect in PluginManager.get_default ().get_regions ()) {
rects += rect;
}

break;

case InputArea.NONE:
default:
#if !HAS_MUTTER44
Expand Down

0 comments on commit b80927a

Please sign in to comment.