Skip to content

Commit

Permalink
use gtk to get workarea geometry
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@26857 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 2, 2020
1 parent eaafe1a commit fdd1a5e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/xpra/gtk_common/gtk_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
gi.require_version("GdkPixbuf", "2.0")
from gi.repository import GLib, GdkPixbuf, Pango, GObject, Gtk, Gdk #@UnresolvedImport

from xpra.util import iround, first_time, envint
from xpra.util import iround, first_time, envint, envbool
from xpra.os_util import strtobytes, WIN32, OSX, POSIX
from xpra.log import Logger

Expand All @@ -23,6 +23,8 @@
alphalog = Logger("gtk", "alpha")

SHOW_ALL_VISUALS = False
#try to get workarea from GTK:
GTK_WORKAREA = envbool("XPRA_GTK_WORKAREA", True)

GTK_VERSION_INFO = {}
def get_gtk_version_info() -> dict:
Expand Down Expand Up @@ -303,12 +305,15 @@ def dpi(size_pixels, size_mm):
else:
plug_name = "%i" % j
wmm, hmm = monitor.get_width_mm(), monitor.get_height_mm()
monitor = [plug_name, xs(geom.x), ys(geom.y), xs(geom.width), ys(geom.height), wmm, hmm]
monitor_info = [plug_name, xs(geom.x), ys(geom.y), xs(geom.width), ys(geom.height), wmm, hmm]
screenlog(" monitor %s: %s", j, monitor)
if workareas:
if GTK_WORKAREA and hasattr(monitor, "get_workarea"):
rect = monitor.get_workarea()
monitor_info += list(swork(rect.x, rect.y, rect.width, rect.height))
elif workareas:
w = workareas[j]
monitor += list(swork(*w))
monitors.append(tuple(monitor))
monitor_info += list(swork(*w))
monitors.append(tuple(monitor_info))
screen = display.get_default_screen()
sw, sh = screen.get_width(), screen.get_height()
work_x, work_y, work_width, work_height = swork(0, 0, sw, sh)
Expand Down Expand Up @@ -744,6 +749,7 @@ def main():
with program_context("GTK-Version-Info", "GTK Version Info"):
enable_color()
print("%s" % get_gtk_version_info())
get_screen_sizes()


if __name__ == "__main__":
Expand Down

0 comments on commit fdd1a5e

Please sign in to comment.