void VID_Minimize (void) { if (!sdl_window) return; SDL_MinimizeWindow(sdl_window); }
void Graphics::Minimize() { if (!window_) return; SDL_MinimizeWindow(window_); }
void VID_Minimize (void) { #if SDL_VERSION_ATLEAST(2,0,0) SDL_MinimizeWindow(cls.window); #else SDL_WM_IconifyWindow(); #endif }
bool SDLWindow::SetMinimized (bool minimized) { if (minimized) { SDL_MinimizeWindow (sdlWindow); } else { SDL_RestoreWindow (sdlWindow); } return minimized; }
void GameWindow::set_state(GameWindow::WindowState state) { switch(state) { case WindowState::FULLSCREEN: SDL_SetWindowFullscreen(_handle,SDL_WINDOW_FULLSCREEN); break; case WindowState::MINIMIZED: SDL_MinimizeWindow(_handle); break; case WindowState::WINDOWED: SDL_RestoreWindow(_handle); SDL_SetWindowFullscreen(_handle,0); break; } _state = state; }
/** * Shortcut to 'Boss' key, ie minmize Window and switch to another application */ static void ShortCut_BossKey(void) { /* If we are in full-screen, then return to a window */ Screen_ReturnFromFullScreen(); if (bGrabMouse) { SDL_WM_GrabInput(SDL_GRAB_OFF); bGrabMouse = false; } Main_PauseEmulation(true); /* Minimize Window and give up processing to next one! */ #if WITH_SDL2 SDL_MinimizeWindow(sdlWindow); #else SDL_WM_IconifyWindow(); #endif }
GHOST_TSuccess GHOST_WindowSDL::setState(GHOST_TWindowState state) { switch (state) { case GHOST_kWindowStateNormal: SDL_SetWindowFullscreen(m_sdl_win, SDL_FALSE); SDL_RestoreWindow(m_sdl_win); break; case GHOST_kWindowStateMaximized: SDL_SetWindowFullscreen(m_sdl_win, SDL_FALSE); SDL_MaximizeWindow(m_sdl_win); break; case GHOST_kWindowStateMinimized: SDL_MinimizeWindow(m_sdl_win); break; case GHOST_kWindowStateFullScreen: SDL_SetWindowFullscreen(m_sdl_win, SDL_TRUE); break; default: break; } return GHOST_kSuccess; }
int SDL_WM_IconifyWindow(void) { SDL_MinimizeWindow(SDL_VideoWindow); return 0; }
void Window::Minimize() { SDL_MinimizeWindow(mWindow); }
void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) { int i; static SDL_MouseMotionEvent lastEvent; if (state->verbose & VERBOSE_EVENT) { SDLTest_PrintEvent(event); } switch (event->type) { case SDL_WINDOWEVENT: switch (event->window.event) { case SDL_WINDOWEVENT_CLOSE: { SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); if (window) { SDL_DestroyWindow(window); } } break; } break; case SDL_KEYDOWN: switch (event->key.keysym.sym) { /* Add hotkeys here */ case SDLK_PRINTSCREEN: { SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i]) { SDLTest_ScreenShot(state->renderers[i]); } } } } break; case SDLK_EQUALS: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-+ double the size of the window */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); SDL_SetWindowSize(window, w*2, h*2); } } break; case SDLK_MINUS: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-- half the size of the window */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); SDL_SetWindowSize(window, w/2, h/2); } } break; case SDLK_c: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } if (event->key.keysym.mod & KMOD_ALT) { /* Alt-C toggle a render clip rectangle */ for (i = 0; i < state->num_windows; ++i) { int w, h; if (state->renderers[i]) { SDL_Rect clip; SDL_GetWindowSize(state->windows[i], &w, &h); SDL_RenderGetClipRect(state->renderers[i], &clip); if (SDL_RectEmpty(&clip)) { clip.x = w/4; clip.y = h/4; clip.w = w/2; clip.h = h/2; SDL_RenderSetClipRect(state->renderers[i], &clip); } else { SDL_RenderSetClipRect(state->renderers[i], NULL); } } } } break; case SDLK_v: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-V paste awesome text! */ char *text = SDL_GetClipboardText(); if (*text) { printf("Clipboard: %s\n", text); } else { printf("Clipboard is empty\n"); } SDL_free(text); } break; case SDLK_g: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-G toggle grab */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window) ? SDL_TRUE : SDL_FALSE); } } break; case SDLK_m: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-M maximize */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_MAXIMIZED) { SDL_RestoreWindow(window); } else { SDL_MaximizeWindow(window); } } } break; case SDLK_r: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-R toggle mouse relative mode */ SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode() ? SDL_TRUE : SDL_FALSE); } break; case SDLK_z: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Z minimize */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { SDL_MinimizeWindow(window); } } break; case SDLK_RETURN: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Enter toggle fullscreen */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); } else { SDL_SetWindowFullscreen(window, SDL_TRUE); } } } else if (event->key.keysym.mod & KMOD_ALT) { /* Alt-Enter toggle fullscreen desktop */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); } else { SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); } } } break; case SDLK_b: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-B toggle window border */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { const Uint32 flags = SDL_GetWindowFlags(window); const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0) ? SDL_TRUE : SDL_FALSE; SDL_SetWindowBordered(window, b); } } break; case SDLK_0: if (event->key.keysym.mod & KMOD_CTRL) { SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window); } break; case SDLK_1: if (event->key.keysym.mod & KMOD_CTRL) { FullscreenTo(0, event->key.windowID); } break; case SDLK_2: if (event->key.keysym.mod & KMOD_CTRL) { FullscreenTo(1, event->key.windowID); } break; case SDLK_ESCAPE: *done = 1; break; case SDLK_SPACE: { char message[256]; SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_snprintf(message, sizeof(message), "(%i, %i), rel (%i, %i)\n", lastEvent.x, lastEvent.y, lastEvent.xrel, lastEvent.yrel); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Last mouse position", message, window); break; } default: break; } break; case SDL_QUIT: *done = 1; break; case SDL_MOUSEMOTION: lastEvent = event->motion; break; } }
static SDL_assert_state SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { #ifdef __WIN32__ #define ENDLINE "\r\n" #else #define ENDLINE "\n" #endif const char *envr; SDL_assert_state state = SDL_ASSERTION_ABORT; SDL_Window *window; SDL_MessageBoxData messagebox; SDL_MessageBoxButtonData buttons[] = { { 0, SDL_ASSERTION_RETRY, "Retry" }, { 0, SDL_ASSERTION_BREAK, "Break" }, { 0, SDL_ASSERTION_ABORT, "Abort" }, { SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, SDL_ASSERTION_IGNORE, "Ignore" }, { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, SDL_ASSERTION_ALWAYS_IGNORE, "Always Ignore" } }; char *message; int selected; (void) userdata; /* unused in default handler. */ message = SDL_stack_alloc(char, SDL_MAX_LOG_MESSAGE); if (!message) { /* Uh oh, we're in real trouble now... */ return SDL_ASSERTION_ABORT; } SDL_snprintf(message, SDL_MAX_LOG_MESSAGE, "Assertion failure at %s (%s:%d), triggered %u %s:" ENDLINE " '%s'", data->function, data->filename, data->linenum, data->trigger_count, (data->trigger_count == 1) ? "time" : "times", data->condition); debug_print("\n\n%s\n\n", message); /* let env. variable override, so unit tests won't block in a GUI. */ envr = SDL_getenv("SDL_ASSERT"); if (envr != NULL) { SDL_stack_free(message); if (SDL_strcmp(envr, "abort") == 0) { return SDL_ASSERTION_ABORT; } else if (SDL_strcmp(envr, "break") == 0) { return SDL_ASSERTION_BREAK; } else if (SDL_strcmp(envr, "retry") == 0) { return SDL_ASSERTION_RETRY; } else if (SDL_strcmp(envr, "ignore") == 0) { return SDL_ASSERTION_IGNORE; } else if (SDL_strcmp(envr, "always_ignore") == 0) { return SDL_ASSERTION_ALWAYS_IGNORE; } else { return SDL_ASSERTION_ABORT; /* oh well. */ } } /* Leave fullscreen mode, if possible (scary!) */ window = SDL_GetFocusWindow(); if (window) { if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { SDL_MinimizeWindow(window); } else { /* !!! FIXME: ungrab the input if we're not fullscreen? */ /* No need to mess with the window */ window = NULL; } } /* Show a messagebox if we can, otherwise fall back to stdio */ SDL_zero(messagebox); messagebox.flags = SDL_MESSAGEBOX_WARNING; messagebox.window = window; messagebox.title = "Assertion Failed"; messagebox.message = message; messagebox.numbuttons = SDL_arraysize(buttons); messagebox.buttons = buttons; if (SDL_ShowMessageBox(&messagebox, &selected) == 0) { if (selected == -1) { state = SDL_ASSERTION_IGNORE; } else { state = (SDL_assert_state)selected; } } #ifdef HAVE_STDIO_H else { /* this is a little hacky. */ for ( ; ; ) { char buf[32]; fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : "); fflush(stderr); if (fgets(buf, sizeof (buf), stdin) == NULL) { break; } if (SDL_strcmp(buf, "a") == 0) { state = SDL_ASSERTION_ABORT; break; } else if (SDL_strcmp(buf, "b") == 0) { state = SDL_ASSERTION_BREAK; break; } else if (SDL_strcmp(buf, "r") == 0) { state = SDL_ASSERTION_RETRY; break; } else if (SDL_strcmp(buf, "i") == 0) { state = SDL_ASSERTION_IGNORE; break; } else if (SDL_strcmp(buf, "A") == 0) { state = SDL_ASSERTION_ALWAYS_IGNORE; break; } } } #endif /* HAVE_STDIO_H */ /* Re-enter fullscreen mode */ if (window) { SDL_RestoreWindow(window); } SDL_stack_free(message); return state; }
void SDLFrontend::minimize () { SDL_MinimizeWindow(_window); }
void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) { int i; if (state->verbose & VERBOSE_EVENT) { SDLTest_PrintEvent(event); } switch (event->type) { case SDL_WINDOWEVENT: switch (event->window.event) { case SDL_WINDOWEVENT_SIZE_CHANGED: { SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); if (window) { for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i] && (state->window_flags & SDL_WINDOW_RESIZABLE)) { SDL_Rect viewport; viewport.x = 0; viewport.y = 0; SDL_GetWindowSize(window, &viewport.w, &viewport.h); SDL_RenderSetViewport(state->renderers[i], &viewport); } } } } break; case SDL_WINDOWEVENT_CLOSE: { SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); if (window) { SDL_DestroyWindow(window); } } break; } break; case SDL_KEYDOWN: switch (event->key.keysym.sym) { /* Add hotkeys here */ case SDLK_PRINTSCREEN: { SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i]) { SDLTest_ScreenShot(state->renderers[i]); } } } } break; case SDLK_EQUALS: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrt-+ double the size of the window */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); SDL_SetWindowSize(window, w*2, h*2); } } break; case SDLK_MINUS: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrt-- double the size of the window */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); SDL_SetWindowSize(window, w/2, h/2); } } break; case SDLK_c: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } break; case SDLK_v: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-V paste awesome text! */ char *text = SDL_GetClipboardText(); if (*text) { printf("Clipboard: %s\n", text); } else { printf("Clipboard is empty\n"); } SDL_free(text); } break; case SDLK_g: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-G toggle grab */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window)); } } break; case SDLK_m: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-M maximize */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_MAXIMIZED) { SDL_RestoreWindow(window); } else { SDL_MaximizeWindow(window); } } } break; case SDLK_r: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-R toggle mouse relative mode */ SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode()); } break; case SDLK_z: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Z minimize */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { SDL_MinimizeWindow(window); } } break; case SDLK_RETURN: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Enter toggle fullscreen */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); } else { SDL_SetWindowFullscreen(window, SDL_TRUE); } } } break; case SDLK_b: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-B toggle window border */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { const Uint32 flags = SDL_GetWindowFlags(window); const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0); SDL_SetWindowBordered(window, b); } } break; case SDLK_1: if (event->key.keysym.mod & KMOD_CTRL) { SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Test Message", "You're awesome!", window); } break; case SDLK_ESCAPE: *done = 1; break; default: break; } break; case SDL_QUIT: *done = 1; break; } }
void Host_Minimize_f( void ) { if( host.hWnd ) SDL_MinimizeWindow( host.hWnd ); }
void Window::minimize() { SDL_MinimizeWindow(this->window); }
void Window::minimize() { if (window != nullptr) SDL_MinimizeWindow(window); }
void CommonEvent(CommonState * state, SDL_Event * event, int *done) { int i; if (state->verbose & VERBOSE_EVENT) { PrintEvent(event); } switch (event->type) { case SDL_WINDOWEVENT: switch (event->window.event) { case SDL_WINDOWEVENT_CLOSE: *done = 1; break; } break; case SDL_KEYDOWN: switch (event->key.keysym.sym) { /* Add hotkeys here */ case SDLK_c: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } break; case SDLK_v: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-V paste awesome text! */ char *text = SDL_GetClipboardText(); if (*text) { printf("Clipboard: %s\n", text); } else { printf("Clipboard is empty\n"); } SDL_free(text); } break; case SDLK_g: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-G toggle grab */ } break; case SDLK_m: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-M maximize */ /* FIXME: Which window has focus for this keyboard? */ for (i = 0; i < state->num_windows; ++i) { if (SDL_GetWindowFlags(state->windows[i]) & SDL_WINDOW_MAXIMIZED) { SDL_RestoreWindow(state->windows[i]); } else { SDL_MaximizeWindow(state->windows[i]); } } } break; case SDLK_z: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Z minimize */ /* FIXME: Which window has focus for this keyboard? */ for (i = 0; i < state->num_windows; ++i) { SDL_MinimizeWindow(state->windows[i]); } } break; case SDLK_ESCAPE: *done = 1; break; default: break; } break; case SDL_QUIT: *done = 1; break; } }
int main(int argc, char *argv[]) { int i; char filename[4096]; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); /* Load the SDL library */ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); return (1); } /* Some targets (Mac CoreAudio) need an event queue for audio hotplug, so make and immediately hide a window. */ SDL_MinimizeWindow(SDL_CreateWindow("testaudiohotplug", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0)); if (argc > 1) { SDL_strlcpy(filename, argv[1], sizeof(filename)); } else { SDL_strlcpy(filename, "sample.wav", sizeof(filename)); } /* Load the wave file into memory */ if (SDL_LoadWAV(filename, &spec, &sound, &soundlen) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); quit(1); } #if HAVE_SIGNAL_H /* Set the signals */ #ifdef SIGHUP signal(SIGHUP, poked); #endif signal(SIGINT, poked); #ifdef SIGQUIT signal(SIGQUIT, poked); #endif signal(SIGTERM, poked); #endif /* HAVE_SIGNAL_H */ /* Show the list of available drivers */ SDL_Log("Available audio drivers:"); for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) { SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else while (!done) { SDL_Delay(100); iteration(); } #endif /* Clean up on signal */ SDL_FreeWAV(sound); SDL_Quit(); return (0); }
//--------- Begin of MouseSDL::poll_event ----------// // // Poll mouse events from the direct mouse VXD. // void MouseSDL::poll_event() { SDL_Event event; int moveFlag; moveFlag = 0; while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_KEYDOWN, SDL_JOYBUTTONUP)) { MouseEvent ev; switch (event.type) { case SDL_MOUSEMOTION: // SDL already accelerates relative mouse motions. // Disable to let the user control speed outside of game. #ifdef MOUSE_RELATIVE cur_x += micky_to_displacement(event.motion.xrel); cur_y += micky_to_displacement(event.motion.yrel); #else cur_x = event.motion.x; cur_y = event.motion.y; #endif if(cur_x < bound_x1) cur_x = bound_x1; if(cur_x > bound_x2) cur_x = bound_x2; if(cur_y < bound_y1) cur_y = bound_y1; if(cur_y > bound_y2) cur_y = bound_y2; moveFlag = 1; break; case SDL_MOUSEBUTTONDOWN: ev.x = cur_x; ev.y = cur_y; ev.time = misc.get_time(); //mouseMsg->dwTimeStamp; ev.scan_code = 0; ev.skey_state = skey_state; if (event.button.button == SDL_BUTTON_LEFT) { // left_press = (event.button.state == SDL_PRESSED); left_press = LEFT_BUTTON_MASK; ev.event_type = LEFT_BUTTON; add_event(&ev); } else if (event.button.button == SDL_BUTTON_RIGHT) { //right_press = (event.button.state == SDL_PRESSED); right_press = RIGHT_BUTTON_MASK; ev.event_type = RIGHT_BUTTON; add_event(&ev); } break; case SDL_MOUSEBUTTONUP: ev.x = cur_x; ev.y = cur_y; ev.time = misc.get_time(); //mouseMsg->dwTimeStamp; ev.scan_code = 0; ev.skey_state = skey_state; if (event.button.button == SDL_BUTTON_LEFT) { // left_press = !(event.button.state == SDL_RELEASED); left_press = 0; ev.event_type = LEFT_BUTTON_RELEASE; add_event(&ev); reset_boundary(); } else if (event.button.button == SDL_BUTTON_RIGHT) { //right_press = !(event.button.state == SDL_RELEASED); right_press = 0; ev.event_type = RIGHT_BUTTON_RELEASE; add_event(&ev); } break; case SDL_KEYDOWN: { int bypass = 0; int mod = event.key.keysym.mod & (KMOD_CTRL|KMOD_SHIFT|KMOD_ALT); if (mod == KMOD_LALT || mod == KMOD_RALT) { if (event.key.keysym.sym == SDLK_RETURN) { bypass = 1; sys.toggle_full_screen_flag = 1; sys.need_redraw_flag = 1; } else if (event.key.keysym.sym == SDLK_F4) { bypass = 1; sys.signal_exit_flag = 1; } else if (event.key.keysym.sym == SDLK_TAB) { bypass = 1; SDL_Window *window = SDL_GetWindowFromID(event.key.windowID); SDL_MinimizeWindow(window); } } else if (mod == KMOD_LCTRL || mod == KMOD_RCTRL) { if (event.key.keysym.sym == SDLK_g && !vga.is_full_screen()) { static int grabbed = 0; bypass = 1; SDL_Window *window = SDL_GetWindowFromID(event.key.windowID); if (!grabbed) { SDL_SetWindowGrab(window, SDL_TRUE); grabbed = 1; } else { SDL_SetWindowGrab(window, SDL_FALSE); grabbed = 0; } } } if (!bypass) { update_skey_state(); add_key_event(event.key.keysym.sym, misc.get_time()); } break; } case SDL_KEYUP: update_skey_state(); break; case SDL_TEXTINPUT: case SDL_JOYAXISMOTION: case SDL_JOYBALLMOTION: case SDL_JOYHATMOTION: case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: default: ERR("unhandled event %d\n", event.type); break; } } if(moveFlag) { mouse_cursor.process(cur_x, cur_y); // repaint mouse cursor power.mouse_handler(); } }
void Host_Minimize_f( void ) { #ifdef XASH_SDL if( host.hWnd ) SDL_MinimizeWindow( host.hWnd ); #endif }
static void GLimp_Minimize() { SDL_MinimizeWindow( window ); }
void Window::minimize() const { SDL_MinimizeWindow(_wnd); }
/** Native window should implement this function by performing the equivalent of the Win32 minimize-to-taskbar operation */ void FLinuxWindow::Minimize() { SDL_MinimizeWindow( HWnd ); }
void CommonEvent(CommonState * state, SDL_Event * event, int *done) { int i; if (state->verbose & VERBOSE_EVENT) { PrintEvent(event); } switch (event->type) { case SDL_WINDOWEVENT: switch (event->window.event) { case SDL_WINDOWEVENT_CLOSE: { SDL_Window *window = SDL_GetWindowFromID(event->window.windowID); if (window) { SDL_DestroyWindow(window); } } break; } break; case SDL_KEYDOWN: switch (event->key.keysym.sym) { /* Add hotkeys here */ case SDLK_PRINTSCREEN: { SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { for (i = 0; i < state->num_windows; ++i) { if (window == state->windows[i]) { ScreenShot(state->renderers[i]); } } } } break; case SDLK_c: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } break; case SDLK_v: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-V paste awesome text! */ char *text = SDL_GetClipboardText(); if (*text) { printf("Clipboard: %s\n", text); } else { printf("Clipboard is empty\n"); } SDL_free(text); } break; case SDLK_g: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-G toggle grab */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window)); } } break; case SDLK_m: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-M maximize */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_MAXIMIZED) { SDL_RestoreWindow(window); } else { SDL_MaximizeWindow(window); } } } break; case SDLK_r: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-R toggle mouse relative mode */ SDL_SetRelativeMouseMode(!SDL_GetRelativeMouseMode()); } break; case SDLK_z: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Z minimize */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { SDL_MinimizeWindow(window); } } break; case SDLK_RETURN: if (event->key.keysym.mod & KMOD_CTRL) { /* Ctrl-Enter toggle fullscreen */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); } else { SDL_SetWindowFullscreen(window, SDL_TRUE); } } } break; case SDLK_ESCAPE: *done = 1; break; default: break; } break; case SDL_QUIT: *done = 1; break; } }
static SDL_assert_state SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { const char *envr; SDL_assert_state state = SDL_ASSERTION_ABORT; SDL_Window *window; (void) userdata; /* unused in default handler. */ debug_print("\n\n" "Assertion failure at %s (%s:%d), triggered %u time%s:\n" " '%s'\n" "\n", data->function, data->filename, data->linenum, data->trigger_count, (data->trigger_count == 1) ? "" : "s", data->condition); /* let env. variable override, so unit tests won't block in a GUI. */ envr = SDL_getenv("SDL_ASSERT"); if (envr != NULL) { if (SDL_strcmp(envr, "abort") == 0) { return SDL_ASSERTION_ABORT; } else if (SDL_strcmp(envr, "break") == 0) { return SDL_ASSERTION_BREAK; } else if (SDL_strcmp(envr, "retry") == 0) { return SDL_ASSERTION_RETRY; } else if (SDL_strcmp(envr, "ignore") == 0) { return SDL_ASSERTION_IGNORE; } else if (SDL_strcmp(envr, "always_ignore") == 0) { return SDL_ASSERTION_ALWAYS_IGNORE; } else { return SDL_ASSERTION_ABORT; /* oh well. */ } } /* Leave fullscreen mode, if possible (scary!) */ window = SDL_GetFocusWindow(); if (window) { if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { SDL_MinimizeWindow(window); } else { /* !!! FIXME: ungrab the input if we're not fullscreen? */ /* No need to mess with the window */ window = 0; } } /* platform-specific UI... */ #ifdef __WIN32__ state = SDL_PromptAssertion_windows(data); #elif __MACOSX__ /* This has to be done in an Objective-C (*.m) file, so we call out. */ extern SDL_assert_state SDL_PromptAssertion_cocoa(const SDL_assert_data *); state = SDL_PromptAssertion_cocoa(data); #else /* this is a little hacky. */ for ( ; ; ) { char buf[32]; fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : "); fflush(stderr); if (fgets(buf, sizeof (buf), stdin) == NULL) { break; } if (SDL_strcmp(buf, "a") == 0) { state = SDL_ASSERTION_ABORT; break; } else if (SDL_strcmp(envr, "b") == 0) { state = SDL_ASSERTION_BREAK; break; } else if (SDL_strcmp(envr, "r") == 0) { state = SDL_ASSERTION_RETRY; break; } else if (SDL_strcmp(envr, "i") == 0) { state = SDL_ASSERTION_IGNORE; break; } else if (SDL_strcmp(envr, "A") == 0) { state = SDL_ASSERTION_ALWAYS_IGNORE; break; } } #endif /* Re-enter fullscreen mode */ if (window) { SDL_RestoreWindow(window); } return state; }
void minimise() noexcept { SDL_MinimizeWindow(ptr.get()); }
/* =============== GLimp_Minimize Minimize the game so that user is back at the desktop =============== */ void GLimp_Minimize( void ) { SDL_MinimizeWindow( SDL_window ); }
void graphics_MinimizeWindow(void) { if (!mainwindow) { return; } SDL_MinimizeWindow(mainwindow); }
/* =============== GLimp_Minimize Minimize the game so that user is back at the desktop =============== */ void GLimp_Minimize(void) { SDL_MinimizeWindow( screen ); }
void BasicWindow::Minimize() { SDL_MinimizeWindow(window); }