Rename to window.notify (should have a more robust notification system in the future)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <hx/CFFI.h>
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
#include <SDL_syswm.h>
|
||||
#include <Windows.h>
|
||||
@@ -566,20 +567,27 @@ namespace nme {
|
||||
DEFINE_LIME_LEGACY_PRIM_1(gl_s3d_set_focal_length);
|
||||
#endif
|
||||
|
||||
value lime_window_alert (value count, value speed, value stop_on_forground) {
|
||||
|
||||
value lime_window_notify () {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
|
||||
int count = 0;
|
||||
int speed = 0;
|
||||
bool stopOnForeground = true;
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION (&info.version);
|
||||
SDL_GetWindowWMInfo(SDL_GL_GetCurrentWindow(), &info);
|
||||
SDL_GetWindowWMInfo (SDL_GL_GetCurrentWindow (), &info);
|
||||
|
||||
FLASHWINFO fi;
|
||||
fi.cbSize = sizeof(FLASHWINFO);
|
||||
fi.cbSize = sizeof (FLASHWINFO);
|
||||
fi.hwnd = info.info.win.window;
|
||||
fi.dwFlags = val_bool (stop_on_forground) ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||
fi.uCount = val_int (count);
|
||||
fi.dwTimeout = val_int (speed);
|
||||
FlashWindowEx(&fi);
|
||||
fi.dwFlags = stopOnForeground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||
fi.uCount = count;
|
||||
fi.dwTimeout = speed;
|
||||
FlashWindowEx (&fi);
|
||||
|
||||
#endif
|
||||
|
||||
return alloc_null ();
|
||||
@@ -587,7 +595,7 @@ namespace nme {
|
||||
}
|
||||
|
||||
|
||||
DEFINE_PRIM (lime_window_alert, 3);
|
||||
DEFINE_PRIM (lime_window_notify, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,13 @@ class FlashWindow {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function notify ():Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -114,9 +121,5 @@ class FlashWindow {
|
||||
|
||||
}
|
||||
|
||||
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -520,6 +520,13 @@ class HTML5Window {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function notify ():Void {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -626,9 +633,5 @@ class HTML5Window {
|
||||
|
||||
}
|
||||
|
||||
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -154,6 +154,17 @@ class NativeWindow {
|
||||
}
|
||||
|
||||
|
||||
public function notify ():Void {
|
||||
|
||||
if (handle != null) {
|
||||
|
||||
lime_window_notify (handle);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function resize (width:Int, height:Int):Void {
|
||||
|
||||
if (handle != null) {
|
||||
@@ -233,16 +244,6 @@ class NativeWindow {
|
||||
|
||||
}
|
||||
|
||||
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||
|
||||
if (handle != null) {
|
||||
|
||||
lime_window_alert (handle, count, speed, stopOnForeground);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@:cffi private static function lime_window_close (handle:Float):Void;
|
||||
@:cffi private static function lime_window_create (application:Float, width:Int, height:Int, flags:Int, title:String):Float;
|
||||
@@ -254,13 +255,13 @@ class NativeWindow {
|
||||
@:cffi private static function lime_window_get_x (handle:Float):Int;
|
||||
@:cffi private static function lime_window_get_y (handle:Float):Int;
|
||||
@:cffi private static function lime_window_move (handle:Float, x:Int, y:Int):Void;
|
||||
@:cffi private static function lime_window_notify (handle:Float):Void;
|
||||
@:cffi private static function lime_window_resize (handle:Float, width:Int, height:Int):Void;
|
||||
@:cffi private static function lime_window_set_enable_text_events (handle:Float, enabled:Bool):Void;
|
||||
@:cffi private static function lime_window_set_fullscreen (handle:Float, fullscreen:Bool):Bool;
|
||||
@:cffi private static function lime_window_set_icon (handle:Float, buffer:Dynamic):Void;
|
||||
@:cffi private static function lime_window_set_minimized (handle:Float, minimized:Bool):Bool;
|
||||
@:cffi private static function lime_window_set_title (handle:Float, title:String):String;
|
||||
@:cffi private static function lime_window_alert (handle:Float, count:Int, speed:Int, stopOnForeground:Bool):Void;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -247,6 +247,13 @@ class Window {
|
||||
}
|
||||
|
||||
|
||||
public function notify ():Void {
|
||||
|
||||
backend.notify ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function resize (width:Int, height:Int):Void {
|
||||
|
||||
backend.resize (width, height);
|
||||
@@ -269,12 +276,6 @@ class Window {
|
||||
|
||||
}
|
||||
|
||||
public function alert (count:Int, speed:Int, stopOnForeground:Bool):Void {
|
||||
|
||||
backend.alert (count, speed, stopOnForeground);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function toString ():String {
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ namespace lime {
|
||||
virtual int GetX () = 0;
|
||||
virtual int GetY () = 0;
|
||||
virtual void Move (int x, int y) = 0;
|
||||
virtual void Notify () = 0;
|
||||
virtual void Resize (int width, int height) = 0;
|
||||
virtual void SetEnableTextEvents (bool enable) = 0;
|
||||
virtual bool SetFullscreen (bool fullscreen) = 0;
|
||||
virtual void SetIcon (ImageBuffer *imageBuffer) = 0;
|
||||
virtual bool SetMinimized (bool minimized) = 0;
|
||||
virtual const char* SetTitle (const char* title) = 0;
|
||||
virtual void Alert (int count, int speed, bool stop_on_foreground) = 0;
|
||||
|
||||
Application* currentApplication;
|
||||
int flags;
|
||||
|
||||
@@ -1163,6 +1163,14 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void lime_window_notify (double window) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
targetWindow->Notify ();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void lime_window_resize (double window, int width, int height) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
@@ -1211,13 +1219,6 @@ namespace lime {
|
||||
|
||||
}
|
||||
|
||||
void lime_window_alert (double window, int count, int speed, bool stop_on_forground) {
|
||||
|
||||
Window* targetWindow = (Window*)(intptr_t)window;
|
||||
targetWindow->Alert (count, speed, stop_on_forground);
|
||||
|
||||
}
|
||||
|
||||
|
||||
DEFINE_PRIME1 (lime_application_create);
|
||||
DEFINE_PRIME2v (lime_application_event_manager_register);
|
||||
@@ -1314,13 +1315,13 @@ namespace lime {
|
||||
DEFINE_PRIME1 (lime_window_get_x);
|
||||
DEFINE_PRIME1 (lime_window_get_y);
|
||||
DEFINE_PRIME3v (lime_window_move);
|
||||
DEFINE_PRIME1v (lime_window_notify);
|
||||
DEFINE_PRIME3v (lime_window_resize);
|
||||
DEFINE_PRIME2v (lime_window_set_enable_text_events);
|
||||
DEFINE_PRIME2 (lime_window_set_fullscreen);
|
||||
DEFINE_PRIME2v (lime_window_set_icon);
|
||||
DEFINE_PRIME2 (lime_window_set_minimized);
|
||||
DEFINE_PRIME2 (lime_window_set_title);
|
||||
DEFINE_PRIME4 (lime_window_alert);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -192,6 +192,31 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
void SDLWindow::Notify () {
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
|
||||
int count = 0;
|
||||
int speed = 0;
|
||||
bool stopOnForeground = true;
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION (&info.version);
|
||||
SDL_GetWindowWMInfo (sdlWindow, &info);
|
||||
|
||||
FLASHWINFO fi;
|
||||
fi.cbSize = sizeof(FLASHWINFO);
|
||||
fi.hwnd = info.info.win.window;
|
||||
fi.dwFlags = stopOnForeground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||
fi.uCount = count;
|
||||
fi.dwTimeout = speed;
|
||||
FlashWindowEx (&fi);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SDLWindow::Resize (int width, int height) {
|
||||
|
||||
SDL_SetWindowSize (sdlWindow, width, height);
|
||||
@@ -270,22 +295,6 @@ namespace lime {
|
||||
|
||||
}
|
||||
|
||||
void SDLWindow::Alert (int count, int speed, bool stop_on_foreground) {
|
||||
|
||||
SDL_SysWMinfo info;
|
||||
SDL_VERSION (&info.version);
|
||||
SDL_GetWindowWMInfo(sdlWindow, &info);
|
||||
|
||||
FLASHWINFO fi;
|
||||
fi.cbSize = sizeof(FLASHWINFO);
|
||||
fi.hwnd = info.info.win.window;
|
||||
fi.dwFlags = stop_on_foreground ? FLASHW_ALL | FLASHW_TIMERNOFG : FLASHW_ALL | FLASHW_TIMER;
|
||||
fi.uCount = count;
|
||||
fi.dwTimeout = speed;
|
||||
FlashWindowEx(&fi);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Window* CreateWindow (Application* application, int width, int height, int flags, const char* title) {
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ namespace lime {
|
||||
virtual int GetX ();
|
||||
virtual int GetY ();
|
||||
virtual void Move (int x, int y);
|
||||
virtual void Notify ();
|
||||
virtual void Resize (int width, int height);
|
||||
virtual void SetEnableTextEvents (bool enabled);
|
||||
virtual bool SetFullscreen (bool fullscreen);
|
||||
virtual void SetIcon (ImageBuffer *imageBuffer);
|
||||
virtual bool SetMinimized (bool minimized);
|
||||
virtual const char* SetTitle (const char* title);
|
||||
virtual void Alert (int count, int speed, bool stop_on_foreground);
|
||||
|
||||
SDL_Window* sdlWindow;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user