-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* guess "content-type" based on window "role" and "class-instance" attributes * pass "content-type" to webp encoder * use hint to choose preset and image hint * when "content-type" is set to "video", make it more likely that we'll use a video encoder, and turn off "scrolling" detection git-svn-id: https://xpra.org/svn/Xpra/trunk@17665 3bb7dfac-3a0b-4e04-842a-767bc560f471
- Loading branch information
Showing
5 changed files
with
94 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- coding: utf-8 -*- | ||
# This file is part of Xpra. | ||
# Copyright (C) 2017 Antoine Martin <antoine@devloop.org.uk> | ||
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any | ||
# later version. See the file COPYING for details. | ||
|
||
from xpra.log import Logger | ||
log = Logger("window", "util") | ||
|
||
ROLE_MAP = { | ||
"text" : ("gimp-dock", "gimp-toolbox", ), | ||
"picture" : ("gimp-image-window", ), | ||
"browser" : ("browser", ), | ||
} | ||
|
||
RES_NAME = { | ||
"text" : ("xterm", "terminal", "Eclipse", "gedit", "Mail", ), | ||
"video" : ("vlc", ), | ||
"browser" : ("google-chrome", "Navigator", "VirtualBox Manager", "chromium-browser", ), | ||
"picture" : ("gimp", "VirtualBox Machine"), | ||
} | ||
RES_CLASS = { | ||
"browser" : ("Firefox", "Thunderbird", ), | ||
} | ||
|
||
|
||
def match_map(value, ctmap): | ||
for content_type, values in ctmap.items(): | ||
if any(value.find(x)>=0 for x in values): | ||
return content_type | ||
return None | ||
|
||
def guess_content_type(window): | ||
role = window.get("role") | ||
if role: | ||
v = match_map(role, ROLE_MAP) | ||
if v: | ||
return v | ||
ci = window.get("class-instance") | ||
if not ci or len(ci)!=2: | ||
return "" | ||
res_name, res_class = ci | ||
v = None | ||
if res_name: | ||
v = match_map(res_name, RES_NAME) | ||
if res_class and not v: | ||
v = match_map(res_class, RES_CLASS) | ||
return v or "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters