Esempio n. 1
0
def get_vrefresh():
    try:
        from xpra.x11.bindings.randr_bindings import RandRBindings      #@UnresolvedImport
        randr = RandRBindings()
        v = randr.get_vrefresh()
    except Exception as e:
        screenlog.warn("failed to get VREFRESH: %s", e)
        v = -1
    screenlog("get_vrefresh()=%s", v)
    return v
Esempio n. 2
0
def _get_randr_dpi():
    try:
        from xpra.x11.bindings.randr_bindings import RandRBindings  #@UnresolvedImport
        randr_bindings = RandRBindings()
        wmm, hmm = randr_bindings.get_screen_size_mm()
        w, h =  randr_bindings.get_screen_size()
        dpix = int(w * 25.4 / wmm + 0.5)
        dpiy = int(h * 25.4 / hmm + 0.5)
        screenlog("dpix=%s, dpiy=%s", dpix, dpiy)
        return dpix, dpiy
    except Exception as e:
        screenlog.warn("failed to get dpi: %s", e)
    return -1, -1
Esempio n. 3
0
def _get_randr_dpi():
    try:
        from xpra.x11.bindings.randr_bindings import RandRBindings  #@UnresolvedImport
        randr_bindings = RandRBindings()
        wmm, hmm = randr_bindings.get_screen_size_mm()
        w, h =  randr_bindings.get_screen_size()
        dpix = iround(w * 25.4 / wmm)
        dpiy = iround(h * 25.4 / hmm)
        screenlog("xdpi=%s, ydpi=%s - size-mm=%ix%i, size=%ix%i", dpix, dpiy, wmm, hmm, w, h)
        return dpix, dpiy
    except Exception as e:
        screenlog.warn("failed to get dpi: %s", e)
    return -1, -1
Esempio n. 4
0
def X11RandRBindings():
    if is_X11():
        try:
            from xpra.x11.bindings.randr_bindings import RandRBindings  #@UnresolvedImport
            return RandRBindings()
        except Exception as e:
            log("RandRBindings()", exc_info=True)
            log.error("Error: no X11 RandR bindings")
            log.error(" %s", e)
    return None
Esempio n. 5
0
def test_add(w, h):
    from xpra.x11.gtk_x11.gdk_display_source import init_gdk_display_source
    init_gdk_display_source()
    from xpra.x11.bindings.randr_bindings import RandRBindings, log  #@UnresolvedImport
    log.enable_debug()
    RandR = RandRBindings()
    screen_sizes = RandR.get_xrr_screen_sizes()
    print("screen_sizes=%s" % (screen_sizes, ))
    if (w, h) in screen_sizes:
        print("resolution %s is already present!" % ((w, h), ))
        return
    from xpra.gtk_common.error import xsync
    with xsync:
        r = RandR.add_screen_size(w, h)
        print("add_screen_size(%i, %i)=%s" % (w, h, r))
    import time
    time.sleep(2)
    screen_sizes = RandR.get_xrr_screen_sizes()
    print("updated screen_sizes=%s" % (screen_sizes, ))
Esempio n. 6
0
def set_initial_resolution(res=DEFAULT_VFB_RESOLUTION):
    try:
        log = get_vfb_logger()
        log("set_initial_resolution(%s)", res)
        from xpra.x11.bindings.randr_bindings import RandRBindings  #@UnresolvedImport
        #try to set a reasonable display size:
        randr = RandRBindings()
        if not randr.has_randr():
            log.warn("Warning: no RandR support,")
            log.warn(" default virtual display size unchanged")
            return
        sizes = randr.get_xrr_screen_sizes()
        size = randr.get_screen_size()
        log("RandR available, current size=%s, sizes available=%s", size,
            sizes)
        if res in sizes:
            log("RandR setting new screen size to %s", res)
            randr.set_screen_size(*res)
    except Exception as e:
        log("set_initial_resolution(%s)", res, exc_info=True)
        log.error("Error: failed to set the default screen size:")
        log.error(" %s", e)
Esempio n. 7
0
    add_event_receiver,          #@UnresolvedImport
   )
from xpra.x11.bindings.window_bindings import X11WindowBindings #@UnresolvedImport
from xpra.x11.xroot_props import XRootPropWatcher
from xpra.x11.gtk_x11.window_damage import WindowDamageHandler
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings #@UnresolvedImport
from xpra.x11.bindings.randr_bindings import RandRBindings #@UnresolvedImport
from xpra.x11.x11_server_base import X11ServerBase, mouselog
from xpra.gtk_common.error import xsync, xlog
from xpra.log import Logger

log = Logger("server")

X11Window = X11WindowBindings()
X11Keyboard = X11KeyboardBindings()
RandR = RandRBindings()

windowlog = Logger("server", "window")
geomlog = Logger("server", "window", "geometry")
settingslog = Logger("x11", "xsettings")
metadatalog = Logger("x11", "metadata")
screenlog = Logger("screen")
iconlog = Logger("icon")

MODIFY_GSETTINGS = envbool("XPRA_MODIFY_GSETTINGS", True)


class DesktopModel(WindowModelStub, WindowDamageHandler):
    __gsignals__ = {}
    __gsignals__.update(WindowDamageHandler.__common_gsignals__)
    __gsignals__.update({
Esempio n. 8
0
def main():
    init_gdk_display_source()
    randr = RandRBindings()
    #print(randr.is_dummy16())
    print_nested_dict(randr.get_all_screen_properties())