当前位置: 首页>>代码示例>>Python>>正文


Python prop.prop_set函数代码示例

本文整理汇总了Python中xpra.x11.gtk_x11.prop.prop_set函数的典型用法代码示例。如果您正苦于以下问题:Python prop_set函数的具体用法?Python prop_set怎么用?Python prop_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了prop_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_xpra_client_message_event

 def do_xpra_client_message_event(self, event):
     # FIXME
     # Need to listen for:
     #   _NET_ACTIVE_WINDOW
     #   _NET_CURRENT_DESKTOP
     #   _NET_WM_PING responses
     # and maybe:
     #   _NET_RESTACK_WINDOW
     #   _NET_WM_STATE
     log("do_xpra_client_message_event(%s)", event)
     if event.message_type=="_NET_SHOWING_DESKTOP":
         show = bool(event.data[0])
         self.emit("show-desktop", show)
     elif event.message_type=="_NET_REQUEST_FRAME_EXTENTS":
         #if we're here, that means the window model does not exist
         #(or it would have processed the event)
         #so this must be a an unmapped window
         frame = (0, 0, 0, 0)
         if not X11Window.is_override_redirect(event.window.xid):
             #use the global default:
             frame = prop_get(self._root, "DEFAULT_NET_FRAME_EXTENTS", ["u32"], ignore_errors=True)
         if not frame:
             #fallback:
             frame = (0, 0, 0, 0)
         log("_NET_REQUEST_FRAME_EXTENTS: setting _NET_FRAME_EXTENTS=%s on %#x", frame, event.window.xid)
         with xswallow:
             prop_set(event.window, "_NET_FRAME_EXTENTS", ["u32"], frame)
开发者ID:svn2github,项目名称:Xpra,代码行数:27,代码来源:wm.py

示例2: _setup_ewmh_window

    def _setup_ewmh_window(self):
        # Set up a 1x1 invisible unmapped window, with which to participate in
        # EWMH's _NET_SUPPORTING_WM_CHECK protocol.  The only important things
        # about this window are the _NET_SUPPORTING_WM_CHECK property, and
        # its title (which is supposed to be the name of the window manager).

        # NB, GDK will do strange things to this window.  We don't want to use
        # it for anything.  (In particular, it will call XSelectInput on it,
        # which is fine normally when GDK is running in a client, but since it
        # happens to be using the same connection as we the WM, it will
        # clobber any XSelectInput calls that *we* might have wanted to make
        # on this window.)  Also, GDK might silently swallow all events that
        # are detected on it, anyway.
        self._ewmh_window = gtk.gdk.Window(
            self._root,
            width=1,
            height=1,
            window_type=gtk.gdk.WINDOW_TOPLEVEL,
            event_mask=0,  # event mask
            wclass=gtk.gdk.INPUT_ONLY,
            title=self._wm_name,
        )
        prop_set(self._ewmh_window, "_NET_SUPPORTING_WM_CHECK", "window", self._ewmh_window)
        self.root_set("_NET_SUPPORTING_WM_CHECK", "window", self._ewmh_window)
        self.root_set("_NET_WM_NAME", "utf8", self._wm_name.decode("utf8"))
开发者ID:svn2github,项目名称:Xpra,代码行数:25,代码来源:wm.py

示例3: set_settings

 def set_settings(self, settings):
     if type(settings)==list:
         settings = tuple(settings)
     elif type(settings)!=tuple:
         log.warn("discarding xsettings because of incompatible format: %s", type(settings))
         return
     prop_set(self._window, XSETTINGS, XSETTINGS_TYPE, settings)
开发者ID:svn2github,项目名称:Xpra,代码行数:7,代码来源:xsettings.py

示例4: set_bypass_compositor

 def set_bypass_compositor(self, v):
     if not HAS_X11_BINDINGS:
         return
     if v not in (0, 1, 2):
         v = 0
     if not self.is_realized():
         self.realize()
     prop_set(self.get_window(), "_NET_WM_BYPASS_COMPOSITOR", "u32", v)
开发者ID:svn2github,项目名称:Xpra,代码行数:8,代码来源:gtk_client_window_base.py

示例5: show

 def show(self):
     if self.group_leader:
         if not self.is_realized():
             self.realize()
         self.window.set_group(self.group_leader)
     gtk.Window.show(self)
     #now it is realized, we can set WM_COMMAND (for X11 clients only)
     command = self._metadata.strget("command")
     if command and HAS_X11_BINDINGS:
         prop_set(self.get_window(), "WM_COMMAND", "latin1", command.decode("latin1"))
开发者ID:svn2github,项目名称:Xpra,代码行数:10,代码来源:gtk_client_window_base.py

示例6: _sync_frame

 def _sync_frame(self, *args):
     v = self.get_property("frame")
     framelog("sync_frame: frame(%#x)=%s", self.xid, v)
     if not v and (not self.is_OR() and not self.is_tray()):
         root = self.client_window.get_screen().get_root_window()
         v = prop_get(root, "DEFAULT_NET_FRAME_EXTENTS", ["u32"], ignore_errors=True)
     if not v:
         #default for OR, or if we don't have any other value:
         v = (0, 0, 0, 0)
     framelog("sync_frame: setting _NET_FRAME_EXTENTS=%s on %#x", v, self.xid)
     with xswallow:
         prop_set(self.client_window, "_NET_FRAME_EXTENTS", ["u32"], v)
开发者ID:svn2github,项目名称:Xpra,代码行数:12,代码来源:core.py

示例7: setup

    def setup(self):
        super(WindowModel, self).setup()

        x, y, w, h, _ = self.client_window.get_geometry()
        # We enable PROPERTY_CHANGE_MASK so that we can call
        # x11_get_server_time on this window.
        self.corral_window = gtk.gdk.Window(self.parking_window,
                                            x = x, y = y, width =w, height= h,
                                            window_type=gtk.gdk.WINDOW_CHILD,
                                            wclass=gtk.gdk.INPUT_OUTPUT,
                                            event_mask=gtk.gdk.PROPERTY_CHANGE_MASK,
                                            title = "CorralWindow-%#x" % self.xid)
        log("setup() corral_window=%#x", self.corral_window.xid)
        prop_set(self.corral_window, "_NET_WM_NAME", "utf8", u"Xpra-CorralWindow-%#x" % self.xid)
        X11Window.substructureRedirect(self.corral_window.xid)
        add_event_receiver(self.corral_window, self)

        # The child might already be mapped, in case we inherited it from
        # a previous window manager.  If so, we unmap it now, and save the
        # serial number of the request -- this way, when we get an
        # UnmapNotify later, we'll know that it's just from us unmapping
        # the window, not from the client withdrawing the window.
        if X11Window.is_mapped(self.xid):
            log("hiding inherited window")
            self.last_unmap_serial = X11Window.Unmap(self.xid)

        log("setup() adding to save set")
        X11Window.XAddToSaveSet(self.xid)
        self.in_save_set = True

        log("setup() reparenting")
        X11Window.Reparent(self.xid, self.corral_window.xid, 0, 0)
        self.client_reparented = True

        log("setup() geometry")
        w, h = X11Window.geometry_with_border(self.xid)[2:4]
        hints = self.get_property("size-hints")
        log("setup() hints=%s size=%ix%i", hints, w, h)
        nw, nh = calc_constrained_size(w, h, hints)
        if nw>=MAX_WINDOW_SIZE or nh>=MAX_WINDOW_SIZE:
            #we can't handle windows that big!
            raise Unmanageable("window constrained size is too large: %sx%s (from client geometry: %s,%s with size hints=%s)" % (nw, nh, w, h, hints))
        self._updateprop("geometry", (x, y, nw, nh))
        log("setup() resizing windows to %sx%s", nw, nh)
        self.corral_window.resize(nw, nh)
        self.client_window.resize(nw, nh)
        self.client_window.show_unraised()
        #this is here to trigger X11 errors if any are pending
        #or if the window is deleted already:
        self.client_window.get_geometry()
开发者ID:svn2github,项目名称:Xpra,代码行数:50,代码来源:window.py

示例8: move_to_workspace

 def move_to_workspace(self, workspace):
     #we send a message to ourselves, we could also just update the property
     current = self.get_property("workspace")
     if current==workspace:
         workspacelog("move_to_workspace(%s) unchanged", workspacestr(workspace))
         return
     workspacelog("move_to_workspace(%s) current=%s", workspacestr(workspace), workspacestr(current))
     with xswallow:
         if workspace==WORKSPACE_UNSET:
             workspacelog("removing _NET_WM_DESKTOP property from window %#x", self.xid)
             X11Window.XDeleteProperty(self.xid, "_NET_WM_DESKTOP")
         else:
             workspacelog("setting _NET_WM_DESKTOP=%s on window %#x", workspacestr(workspace), self.xid)
             prop_set(self.client_window, "_NET_WM_DESKTOP", "u32", workspace)
开发者ID:ljmljz,项目名称:xpra,代码行数:14,代码来源:base.py

示例9: set_workspace

 def set_workspace(self, workspace):
     if not self._can_set_workspace:
         return None
     desktop = self.get_desktop_workspace()
     if self._been_mapped and (workspace==desktop or desktop is None):
         #window is back in view
         self._client.control_refresh(self._id, False, False)
     ndesktops = self.get_workspace_count()
     if ndesktops is None or ndesktops<=1:
         workspacelog("number of desktops not defined, cannot set workspace")
         return None
     if workspace<0:
         #this should not happen, workspace is unsigned! (CARDINAL)
         workspace = WORKSPACE_UNSET
         workspacelog.warn("invalid workspace number: %s", self._window_workspace)
     workspacelog("%s.set_workspace() workspace=%s ndesktops=%s", self, workspace, ndesktops)
     #we will need the gdk window:
     if not self.is_realized():
         self.realize()
     gdkwin = self.get_window()
     if workspace==WORKSPACE_UNSET:
         #we want to remove the setting, so access the window property directly:
         self._window_workspace = workspace
         with xswallow:
             X11Window.XDeleteProperty(gdkwin.xid, "_NET_WM_DESKTOP")
         return self._window_workspace
     #clamp to number of workspaces just in case we have a mismatch:
     if workspace==WORKSPACE_ALL:
         self._window_workspace = WORKSPACE_ALL
     else:
         self._window_workspace = max(0, min(ndesktops-1, workspace))
     workspacelog("%s.set_workspace() clamped workspace=%s", self, self._window_workspace)
     if not gdkwin.is_visible():
         #window is unmapped so we can set the window property directly:
         prop_set(self.get_window(), "_NET_WM_DESKTOP", "u32", self._window_workspace)
         return self._window_workspace
     #the window is visible, so we have to ask the window manager politely
     with xsync:
         send_wm_workspace(root, self.get_window(), self._window_workspace)
     return self._window_workspace
开发者ID:svn2github,项目名称:Xpra,代码行数:40,代码来源:gtk_client_window_base.py

示例10: set_icc_profile

 def set_icc_profile(self):
     ui_clients = [s for s in self._server_sources.values() if s.ui_client]
     if len(ui_clients)!=1:
         screenlog("%i UI clients, not setting ICC profile")
         self.reset_icc_profile()
         return
     icc = ui_clients[0].icc
     data = None
     for x in ("data", "icc-data", "icc-profile"):
         if x in icc:
             data = icc.get(x)
             break
     if not data:
         screenlog("no icc data found in %s", icc)
         self.reset_icc_profile()
         return
     import binascii
     screenlog("set_icc_profile() icc data for %s: %s (%i bytes)", ui_clients[0], binascii.hexlify(data or ""), len(data or ""))
     from xpra.x11.gtk_x11.prop import prop_set
     #each CARD32 contains just one 8-bit value - don't ask me why
     prop_set(self.root_window, "_ICC_PROFILE", ["u32"], [ord(x) for x in data])
     prop_set(self.root_window, "_ICC_PROFILE_IN_X_VERSION", "u32", 0*100+4) #0.4 -> 0*100+4*1
开发者ID:svn2github,项目名称:Xpra,代码行数:22,代码来源:x11_server_base.py

示例11: set_strut

 def set_strut(self, strut):
     if not HAS_X11_BINDINGS:
         return
     log("strut=%s", strut)
     d = typedict(strut)
     values = []
     for x in ("left", "right", "top", "bottom"):
         values.append(d.intget(x, 0))
     has_partial = False
     for x in ("left_start_y", "left_end_y",
               "right_start_y", "right_end_y",
               "top_start_x", "top_end_x",
               "bottom_start_x", "bottom_end_x"):
         if x in d:
             has_partial = True
         values.append(d.intget(x, 0))
     log("setting strut=%s, has partial=%s", values, has_partial)
     if not self.is_realized():
         self.realize()
     if has_partial:
         prop_set(self.get_window(), "_NET_WM_STRUT_PARTIAL", ["u32"], values)
     prop_set(self.get_window(), "_NET_WM_STRUT", ["u32"], values[:4])
开发者ID:svn2github,项目名称:Xpra,代码行数:22,代码来源:gtk_client_window_base.py

示例12: _set_gtk_x11_window_menu

def _set_gtk_x11_window_menu(add, wid, window, menus, application_action_callback=None, window_action_callback=None):
    from xpra.x11.dbus.menu import setup_dbus_window_menu
    from xpra.x11.gtk_x11.prop import prop_set, prop_del
    window_props = setup_dbus_window_menu(add, wid, menus, application_action_callback, window_action_callback)
    #window_props may contains X11 window properties we have to clear or set
    if not window_props:
        return
    if not window:
        #window has already been closed
        #(but we still want to call setup_dbus_window_menu above to ensure we clear things up!)
        return
    menulog("will set/remove the following window properties for wid=%i: %s", wid, window_props)
    try:
        from xpra.gtk_common.error import xsync
        with xsync:
            for k,v in window_props.items():
                if v is None:
                    prop_del(window, k)
                else:
                    vtype, value = v
                    prop_set(window, k, vtype, value)
    except Exception as e:
        menulog.error("Error setting menu window properties:")
        menulog.error(" %s", e)
开发者ID:svn2github,项目名称:Xpra,代码行数:24,代码来源:gui.py

示例13: set_tray_visual

def set_tray_visual(tray_window, gdk_visual):
    prop_set(tray_window, TRAY_VISUAL, "visual", gdk_visual)
开发者ID:svn2github,项目名称:Xpra,代码行数:2,代码来源:tray.py

示例14: xset_u32_property

 def xset_u32_property(self, target, name, value):
     prop_set(target, name, "u32", value)
开发者ID:svn2github,项目名称:Xpra,代码行数:2,代码来源:gtk_client_window_base.py

示例15: do_set_strut

 def do_set_strut():
     if has_partial:
         prop_set(self.get_window(), "_NET_WM_STRUT_PARTIAL", ["u32"], values)
     prop_set(self.get_window(), "_NET_WM_STRUT", ["u32"], values[:4])
开发者ID:svn2github,项目名称:Xpra,代码行数:4,代码来源:gtk_client_window_base.py


注:本文中的xpra.x11.gtk_x11.prop.prop_set函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。