gdharness 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,9 @@ extends Node
8
8
  ## editor to play means the debugger it owns is holding the game, which is what makes the debug
9
9
  ## tools answer at all.
10
10
 
11
+ ## What the display server calls itself when the engine was started with no display at all.
12
+ const HEADLESS_DISPLAY: String = "headless"
13
+
11
14
  var _editor_plugin: EditorPlugin = null
12
15
 
13
16
 
@@ -56,7 +59,12 @@ func restart_editor(_args: Dictionary) -> Dictionary:
56
59
  # editor restarted by anybody comes up as a project manager with no project, holding the
57
60
  # desktop of whoever was unlucky enough to be watching. A windowed editor was started with
58
61
  # none of that, so Godot's own restart brings back the same editor on the same project.
59
- if not DisplayServer.window_can_draw():
62
+ #
63
+ # Asked of the display server rather than of the window, because window_can_draw answers no
64
+ # for a window that is merely minimised. An editor sitting in the taskbar was told it was
65
+ # headless and refused to restart, which is exactly the editor somebody wants restarted after
66
+ # an upgrade: nobody minimises a window they are watching.
67
+ if DisplayServer.get_name() == HEADLESS_DISPLAY:
60
68
  return {
61
69
  "ok": false,
62
70
  "error":
@@ -162,14 +162,22 @@ func click(params: Dictionary) -> Dictionary:
162
162
  var centre: Vector2 = control.get_global_transform_with_canvas() * (control.size * 0.5)
163
163
  var position: Vector2 = viewport.get_final_transform() * centre
164
164
  # The GUI only delivers to what is inside the viewport, so a centre outside it would be a
165
- # click that silently reached nothing.
165
+ # click that silently reached nothing. A game with no window has a 64 by 64 viewport
166
+ # whatever the project settings say, which is the usual reason to be here and is not
167
+ # something the caller can read off the rect on its own.
166
168
  if not viewport.get_visible_rect().has_point(centre):
169
+ var why: String = ""
170
+ if not _host.get_tree().root.can_draw():
171
+ why = (
172
+ ". This game has no window, and a game with no window has a 64 by 64 viewport "
173
+ + "whatever the project settings say: run it with a window to reach this control"
174
+ )
167
175
  return {
168
176
  "type": "error",
169
177
  "message":
170
178
  (
171
- "%s has its centre at %s, outside the viewport %s, so nothing can click it"
172
- % [node_path, centre, viewport.get_visible_rect()]
179
+ "%s has its centre at %s, outside the viewport %s, so nothing can click it%s"
180
+ % [node_path, centre, viewport.get_visible_rect(), why]
173
181
  )
174
182
  }
175
183
  var button: int = _resolve_mouse_button(params.get("button", MOUSE_BUTTON_LEFT))