Skip to content

Commit

Permalink
#389: disable composition by default on Vista onwards, add XPRA_DISAB…
Browse files Browse the repository at this point in the history
…LE_DWM_COMPOSITION env var

git-svn-id: https://xpra.org/svn/Xpra/trunk@12850 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 17, 2016
1 parent dce6a39 commit adf630c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/xpra/platform/win32/shadow_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
}

SEAMLESS = os.environ.get("XPRA_WIN32_SEAMLESS", "0")=="1"
DISABLE_DWM_COMPOSITION = 1
#no composition on XP, don't bother trying:
try:
from sys import getwindowsversion #@UnresolvedImport
if getwindowsversion().major<6:
DISABLE_DWM_COMPOSITION = 0
except:
pass
DISABLE_DWM_COMPOSITION = os.environ.get("XPRA_DISABLE_DWM_COMPOSITION", str(DISABLE_DWM_COMPOSITION))=="1"


class Win32RootWindowModel(RootWindowModel):
Expand All @@ -53,11 +62,20 @@ def __init__(self, root):
RootWindowModel.__init__(self, root)
self.metrics = None
self.ddc, self.cdc, self.memdc, self.bitmap = None, None, None, None
if DISABLE_DWM_COMPOSITION:
try:
from ctypes import windll
DWM_EC_DISABLECOMPOSITION = 0
windll.dwmapi.DwmEnableComposition(DWM_EC_DISABLECOMPOSITION)
except Exception as e:
log.error("Error: cannot disable composition:")
log.error(" %s", e)
if SEAMLESS:
self.property_names.append("shape")
self.dynamic_property_names.append("shape")
self.rectangles = self.get_shape_rectangles(logit=True)
self.shape_notify = []


def refresh_shape(self):
rectangles = self.get_shape_rectangles()
Expand Down

0 comments on commit adf630c

Please sign in to comment.