Просмотр исходного кода

tools: Windows: fix editor view redraw

Daniele Bartolini 4 лет назад
Родитель
Сommit
29b095f56d
2 измененных файлов с 11 добавлено и 16 удалено
  1. 0 15
      tools/level_editor/editor_view.vala
  2. 11 1
      tools/level_editor/level_editor.vala

+ 0 - 15
tools/level_editor/editor_view.vala

@@ -128,11 +128,6 @@ public class EditorView : Gtk.EventBox
 			device_frame_delayed(16, _client);
 			return Gdk.EVENT_PROPAGATE;
 		});
-		_socket.unmap_event.connect(() => {
-			LevelEditorApplication app = (LevelEditorApplication)((Gtk.Window)this.get_toplevel()).application;
-			device_frame_delayed(16, app._editor);
-			return Gdk.EVENT_PROPAGATE;
-		});
 		this.add(_socket);
 #elif CROWN_PLATFORM_WINDOWS
 		this.realize.connect(on_event_box_realized);
@@ -144,16 +139,6 @@ public class EditorView : Gtk.EventBox
 #endif
 	}
 
-	private void device_frame_delayed(uint delay_ms, ConsoleClient client)
-	{
-		// FIXME: find a way to time exactly when it is effective to queue a redraw.
-		// See: https://blogs.gnome.org/jnelson/2010/10/13/those-realize-map-widget-signals/
-		GLib.Timeout.add_full(GLib.Priority.DEFAULT, delay_ms, () => {
-			client.send(DeviceApi.frame());
-			return false;
-		});
-	}
-
 	private bool on_button_release(Gdk.EventButton ev)
 	{
 		_mouse_left   = ev.button == Gdk.BUTTON_PRIMARY   ? false : _mouse_left;

+ 11 - 1
tools/level_editor/level_editor.vala

@@ -521,7 +521,7 @@ public class LevelEditorApplication : Gtk.Application
 		_resource_popover.events |= Gdk.EventMask.STRUCTURE_MASK; // unmap_event
 		_resource_popover.unmap_event.connect(() => {
 			// Redraw the editor view when the popover is not on-screen anymore.
-			_editor.send(DeviceApi.frame());
+			device_frame_delayed(16, _editor);
 			return Gdk.EVENT_PROPAGATE;
 		});
 		_resource_popover.delete_event.connect(() => {
@@ -2512,6 +2512,16 @@ public static int wait_process(out int exit_status, GLib.Subprocess? process)
 	}
 }
 
+private void device_frame_delayed(uint delay_ms, ConsoleClient client)
+{
+	// FIXME: find a way to time exactly when it is effective to queue a redraw.
+	// See: https://blogs.gnome.org/jnelson/2010/10/13/those-realize-map-widget-signals/
+	GLib.Timeout.add_full(GLib.Priority.DEFAULT, delay_ms, () => {
+		client.send(DeviceApi.frame());
+		return false;
+	});
+}
+
 public static int main(string[] args)
 {
 	// Global paths