By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

window-list: Use single wl_surface object

soreau,
created on Tuesday, 19 August 2025, 00:48:15 (1755564495), received on Tuesday, 19 August 2025, 05:03:46 (1755579826)
Author identity: Scott Moreau <oreaus@gmail.com>

0fe7b3ebe3948d9c16d9a07673dc6cec5fbb7264

applets/wf-window-list/__init__.py

@@ -509,9 +509,11 @@ class WFWindowList(panorama_panel.Applet):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.seat = registry.bind(name, WlSeat, version)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    elif interface == "wl_compositor":
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.compositor = registry.bind(name, WlCompositor, version)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.wl_surface_ptr = gtk.gdk_wayland_surface_get_wl_surface(
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    wl_surface_ptr = gtk.gdk_wayland_surface_get_wl_surface(
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                ffi.cast("void *", ctypes.pythonapi.PyCapsule_GetPointer(
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                    self.get_root().get_native().get_surface().__gpointer__, None)))
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.wl_surface = WlSurface()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                    self.wl_surface._ptr = wl_surface_ptr
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def on_new_toplevel(self, manager: ZwlrForeignToplevelManagerV1,
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                     handle: ZwlrForeignToplevelHandleV1):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -561,17 +563,13 @@ class WFWindowList(panorama_panel.Applet):

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    child = self.get_first_child()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    while child is not None:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if isinstance(child, WindowButton):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        surface = WlSurface()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        surface._ptr = self.wl_surface_ptr
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        child.window_id.set_rectangle(surface, *get_widget_rect(child))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                        child.window_id.set_rectangle(self.wl_surface, *get_widget_rect(child))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        child = child.get_next_sibling()
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                def on_button_click(self, button: WindowButton):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # Set a rectangle for animation
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                surface = WlSurface()
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                surface._ptr = self.wl_surface_ptr
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                button.window_id.set_rectangle(surface, *get_widget_rect(button))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                button.window_id.set_rectangle(self.wl_surface, *get_widget_rect(button))
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    if button.window_state.focused:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        # Already pressed in, so minimise the focused window
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        button.window_id.set_minimized()