From: Oliver Kurth Date: Mon, 20 Aug 2018 19:48:09 +0000 (-0700) Subject: Calculating monitor work area: No bar exists if seamless maximizing X-Git-Tag: stable-11.0.0~457 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6e035ee1cfd3fe43df893a0a46ccba870540a1b;p=thirdparty%2Fopen-vm-tools.git Calculating monitor work area: No bar exists if seamless maximizing In Unbuntu 18.04, Redhat 7.4, 7.5, the work area size could not be calculated based on _NET_WM_STRUT or _NET_WM_STRUT_PARTIAL. These two properties could not be retrived through the window manger. In this fix, use _NET_WORKAREA to get the work area, but this is only available with a single monitor. --- diff --git a/open-vm-tools/services/plugins/dndcp/xutils/xutils.cc b/open-vm-tools/services/plugins/dndcp/xutils/xutils.cc index cd5920d03..bae910781 100644 --- a/open-vm-tools/services/plugins/dndcp/xutils/xutils.cc +++ b/open-vm-tools/services/plugins/dndcp/xutils/xutils.cc @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2018 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -980,14 +980,13 @@ GetMonitorWorkArea(Glib::RefPtr screen, // IN: * need. */ HostWindowList windows = GetHostWindowStack(); - + bool haveStrut = false; for (HostWindowList::const_iterator iter = windows.begin(); iter != windows.end(); iter++) { Glib::RefPtr gdkWindow = *iter; std::vector values; - bool haveStrut = false; NETWMStrutPartial strut = NETWMStrutPartial(); if (monitor != screen->get_monitor_at_window(gdkWindow)) { @@ -1115,8 +1114,26 @@ GetMonitorWorkArea(Glib::RefPtr screen, // IN: workAreaRegion->subtract(rect); } } - - rect = workAreaRegion->get_extents(); + /* bug:2163225: _NET_WM_STRUT_PARTIAL and _NET_WM_STRUT could not be retrived in redhat 7.4,7.5, + * root cause unknown, have to use _NET_WORKAREA to get Work area directly in redhat 7.4,7.5, note + * this fix only works in single monitor. + */ + int monitorNum = screen->get_n_monitors(); + if ((!haveStrut) && (1 == monitorNum)) { + std::vector values; + if (GetCardinalList(screen->get_root_window(), "_NET_WORKAREA", values) && values.size() >= 4 ) { + rect.x=values[0]; + rect.y=values[1]; + rect.width=values[2]; + rect.height=values[3]; + } else { + //Property: _NET_WORKAREA not found, workArea set keeps screen size + Log("Property:_NET_WORKAREA unable to get or in multi monitor."); + rect = workAreaRegion->get_extents(); + } + } else { + rect = workAreaRegion->get_extents(); + } workArea.set_x(rect.x); workArea.set_y(rect.y); workArea.set_width(rect.width);