xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #76: xpra-send_new_window_pixels.patch

File xpra-send_new_window_pixels.patch, 4.8 KB (added by Antoine Martin, 10 years ago)

this patch combines the new-override-redirect with the window's draw packet

  • xpra/server.py

     
    645645
    646646        self.reset_statistics()
    647647
     648        self.send_new_window_pixels = False
    648649        self.send_damage_sequence = False
    649650        self.send_notifications = False
    650651        self.last_cursor_serial = None
     
    11721173            self._protocol.source.cancel_damage(wid)
    11731174
    11741175    def _send_new_window_packet(self, window):
    1175         wid = self._window_to_id[window]
    1176         (x, y, w, h) = self._desktop_manager.window_geometry(window)
    1177         metadata = {}
    1178         for propname in self._all_metadata:
    1179             metadata.update(self._make_metadata(window, propname))
    1180         self._send(["new-window", wid, x, y, w, h, metadata])
     1176        geometry = self._desktop_manager.window_geometry(window)
     1177        self._do_send_new_window_packet("new-window", window, geometry, self._all_metadata, False)
    11811178
    11821179    def _send_new_or_window_packet(self, window):
     1180        geometry = window.get_property("geometry")
     1181        properties = ["transient-for", "window-type"]
     1182        self._do_send_new_window_packet("new-override-redirect", window, geometry, properties, True)
     1183
     1184    def _do_send_new_window_packet(self, ptype, window, geometry, properties, send_pixels=False):
    11831185        wid = self._window_to_id[window]
    1184         (x, y, w, h) = window.get_property("geometry")
     1186        (x, y, w, h) = geometry
    11851187        metadata = {}
    1186         for propname in ["transient-for", "window-type"]:
     1188        for propname in properties:
    11871189            metadata.update(self._make_metadata(window, propname))
    1188         self._send(["new-override-redirect", wid, x, y, w, h, metadata])
    1189         self._damage(window, 0, 0, w, h)
     1190        packet = [ptype, wid, x, y, w, h, metadata]
     1191        if send_pixels and self.send_new_window_pixels:
     1192            pixmap = window.get_property("client-contents")
     1193            if pixmap is None:
     1194                log.error("wtf, pixmap is None for window %s, wid=%s", window, wid)
     1195            else:
     1196                item = _get_rgb_rawdata(wid, pixmap, 0, 0, w, h, self.encoding, -1, None)
     1197                draw_packet = self._server_source.make_data_packet(item)
     1198                log.info("adding draw packet to %s", ptype)
     1199                packet.append(draw_packet)
     1200        self._send(packet)
     1201        if not self.send_new_window_pixels and send_pixels:
     1202            self._damage(window, 0, 0, w, h)
    11901203
    11911204    def _update_metadata(self, window, pspec):
    11921205        wid = self._window_to_id[window]
     
    14181431        self.send_bell = capabilities.get("bell", False)
    14191432        self.send_notifications = capabilities.get("notifications", False)
    14201433        self.can_ping = capabilities.get("ping", False)
     1434        self.send_new_window_pixels = capabilities.get("new_window_pixels", False)
    14211435        self.clipboard_enabled = capabilities.get("clipboard", True) and self._clipboard_helper is not None
    14221436        log.debug("cursors=%s, bell=%s, notifications=%s, clipboard=%s", self.send_cursors, self.send_bell, self.send_notifications, self.clipboard_enabled)
    14231437        self._wm.enableCursors(self.send_cursors)
  • xpra/client.py

     
    4848        self._refresh_timer = None
    4949        self._refresh_requested = False
    5050        # used for only sending focus events *after* the window is mapped:
     51        self._on_map_event = None
    5152        self._been_mapped = False
    5253        self._override_redirect_windows = []
    5354
     
    275276            self._pos = (x, y)
    276277            self._size = (w, h)
    277278        self._been_mapped = True
     279        if self._on_map_event:
     280            gobject.idle_add(self._on_map_event)
    278281        gobject.idle_add(self._focus_change)
    279282
    280283    def do_configure_event(self, event):
     
    845848        capabilities["damage_sequence"] = True
    846849        capabilities["rowstride"] = True
    847850        capabilities["ping"] = True
     851        capabilities["new_window_pixels"] = True
    848852        key_repeat = self._client_extras.get_keyboard_repeat()
    849853        if key_repeat:
    850854            delay_ms,interval_ms = key_repeat
     
    988992        window = ClientWindow(self, wid, x, y, w, h, metadata, override_redirect)
    989993        self._id_to_window[wid] = window
    990994        self._window_to_id[window] = wid
     995        if override_redirect and len(packet)>=8:
     996            log.info("found draw packet with new window!")
     997            draw_packet = packet[7]
     998            def draw_initial(*args):
     999                log.info("draw initial!")
     1000                self._process_draw(draw_packet)
     1001                window._on_map_event = None
     1002            window._on_map_event = draw_initial
    9911003        window.show_all()
    9921004
    9931005    def _process_new_window(self, packet):