( s protocols.ClientState, xdgSurfaceObjectID protocols.ObjectID[protocols.XdgSurface], id protocols.ObjectID[protocols.XdgToplevel], )
| 65 | } |
| 66 | |
| 67 | func (x *XdgSurface) XdgSurface_get_toplevel( |
| 68 | s protocols.ClientState, |
| 69 | xdgSurfaceObjectID protocols.ObjectID[protocols.XdgSurface], |
| 70 | id protocols.ObjectID[protocols.XdgToplevel], |
| 71 | ) { |
| 72 | surface_id := GetSurfaceIDFromRole(s, xdgSurfaceObjectID) |
| 73 | if surface_id == nil { |
| 74 | SendError(s, |
| 75 | xdgSurfaceObjectID, |
| 76 | protocols.XdgSurfaceError_enum_not_constructed, |
| 77 | "surface not found", |
| 78 | ) |
| 79 | return |
| 80 | } |
| 81 | |
| 82 | surface := GetSurfaceFromRole(s, xdgSurfaceObjectID) |
| 83 | if surface == nil { |
| 84 | SendError(s, |
| 85 | xdgSurfaceObjectID, |
| 86 | protocols.XdgSurfaceError_enum_not_constructed, |
| 87 | "surface not found", |
| 88 | ) |
| 89 | return |
| 90 | } |
| 91 | |
| 92 | if surface.Role == nil { |
| 93 | surface.Role = &SurfaceRoleXdgToplevel{} |
| 94 | } |
| 95 | |
| 96 | surfaceRole, surface_role_is_xdg_toplevel := surface.Role.(*SurfaceRoleXdgToplevel) |
| 97 | if !surface_role_is_xdg_toplevel { |
| 98 | SendError(s, |
| 99 | xdgSurfaceObjectID, |
| 100 | protocols.XdgSurfaceError_enum_defunct_role_object, |
| 101 | "surface not found", |
| 102 | ) |
| 103 | return |
| 104 | } |
| 105 | |
| 106 | if surfaceRole.Data != nil { |
| 107 | SendError(s, |
| 108 | xdgSurfaceObjectID, |
| 109 | protocols.XdgSurfaceError_enum_defunct_role_object, |
| 110 | "surface already has a role", |
| 111 | ) |
| 112 | return |
| 113 | } |
| 114 | |
| 115 | surfaceRole.Data = &id |
| 116 | AddObject(s, id, MakeXdgToplevel()) |
| 117 | |
| 118 | RegisterRoleToSurface(s, id, *surface_id) |
| 119 | s.TopLevelSurfaces()[id] = true |
| 120 | |
| 121 | protocols.XdgToplevel_configure( |
| 122 | s, |
| 123 | id, |
| 124 | int32(VirtualMonitorSize.Width), |
nothing calls this directly
no test coverage detected