static gboolean key_callback(GtkWidget * w, GdkEventKey * evt, gpointer data) { visualizer_t * v = (visualizer_t*)data; // gtk_widget_show(v->toolbar); // g_timeout_add(2000, toolbar_timeout, v); switch(evt->keyval) { case GDK_Tab: case GDK_f: toggle_fullscreen(v); return TRUE; break; case GDK_Escape: if(v->current_window == &v->fullscreen_window) toggle_fullscreen(v); return TRUE; break; case GDK_Menu: if(v->toolbar_trigger & TOOLBAR_TRIGGER_KEY) show_toolbar(v); return TRUE; break; } return FALSE; }
int main (int argc, char *argv[]) { gtk_init (&argc, &argv); backend_init (&argc, &argv); start (); if (argc > 1) { filename = g_strdup (argv[1]); } toggle_fullscreen (); g_idle_add (init, NULL); g_timeout_add (1000, timeout, NULL); gtk_main (); g_free (filename); backend_deinit (); return 0; }
static void create_surface(struct window *window) { struct display *display = window->display; EGLBoolean ret; window->surface = wl_compositor_create_surface(display->compositor); window->shell_surface = wl_shell_get_shell_surface(display->shell, window->surface); wl_shell_surface_add_listener(window->shell_surface, &shell_surface_listener, window); window->native = wl_egl_window_create(window->surface, window->window_size.width, window->window_size.height); window->egl_surface = eglCreateWindowSurface(display->egl.dpy, display->egl.conf, window->native, NULL); wl_shell_surface_set_title(window->shell_surface, "simple-egl"); ret = eglMakeCurrent(window->display->egl.dpy, window->egl_surface, window->egl_surface, window->display->egl.ctx); assert(ret == EGL_TRUE); toggle_fullscreen(window, window->fullscreen); }
void toggle_fullscreen() { toggle_fullscreen(! screen_mode.fullscreen); if (!in_game) { update_game_window(); } }
int command(const char *cmd) { if (strncasecmp(cmd,"pen",3)==0) pens(cmd); else if (strncasecmp(cmd,"dot",3)==0) pens(cmd); //else if (strncasecmp(cmd,"act",3)==0) action_link(cmd); else if (strncasecmp(cmd,"act",3)==0) action(cmd); else if (strncasecmp(cmd,"cust",4)==0) pens(cmd); else if (strncasecmp(cmd,"sort",4)==0) sorter(cmd); else if (strncasecmp(cmd,"prev",4)==0) move(cmd); else if (strncasecmp(cmd,"next",4)==0) move(cmd); else if (strncasecmp(cmd,"redr",4)==0) draw(None); else if (strncasecmp(cmd,"mute",4)==0) mute(cmd); else if (strncasecmp(cmd,"quit",4)==0) running = False; else if (strncasecmp(cmd,"full",4)==0) toggle_fullscreen(); else if (strncasecmp(cmd,"zoom",4)==0) { char *c; if ( (c=strchr(cmd, ' ')) ) { while (c && *c == ' ') c++; if (*c == '\0') return 1; if (*c == 'q') { if (!(c=strchr(c, ' '))) return 1; while (c && *c == ' ') c++; if (*c == '\0') return 1; else if (*c == '1') zoom_rect(0, 0, show->w/2, show->h/2); else if (*c == '2') zoom_rect(show->w/2, 0, show->w, show->h/2); else if (*c == '3') zoom_rect(0, show->h/2, show->w/2, show->h); else if (*c == '4') zoom_rect(show->w/2, show->h/2, show->w, show->h); else return 1; } else pens(cmd); } else return 1; } XSync(dpy, True); return 0; }
// This will read if there is data coming from pipe, // and if there is, read it and do things if so wanted. gboolean read_from_pipe( APP *app ) { char buffer[2048]; int readed = read( app->fifo, buffer, sizeof( buffer ) -2 ); if( readed > 0 ) { buffer[readed] = '\0'; // Should we load image? if( strstr( buffer, "load" ) != 0 ) { char filename[256], tmp[256]; sscanf( buffer, "%s %s\n", &tmp, &filename ); if( app->file != NULL ) free( app->file ); app->file = malloc( strlen( filename ) + 1 ); sprintf( app->file, "%s", filename ); load_image( app ); } else if( strcmp( buffer, "fullscreen\n" ) == 0 ) { toggle_fullscreen( app ); } } return TRUE; }
static void toggle_fullscreen_cb (GtkAction *action, RBVisualizerPage *page) { if (page->setting_state == FALSE) { toggle_fullscreen (page); } }
static gboolean set_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer data ) { mpris *inst = data; if(g_strcmp0(property_name, "Fullscreen") == 0 && g_variant_get_boolean(value) != inst->gmpv_ctx->gui->fullscreen) { toggle_fullscreen(inst->gmpv_ctx); } else { g_hash_table_replace( ((mpris *) data)->base_prop_table, g_strdup(property_name), g_variant_ref(value) ); } return TRUE; /* This function should always succeed */ }
void Game::handle_event(SDL_Event* event) { if (event->type == SDL_QUIT) { game_running = false; } else if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym == SDLK_F10) { if (game_state == GAMEPLAY_RUNNING || game_state == GAME_PAUSED) { old_game_state = game_state; game_state = INGAMEMENU; } else if (game_state == INGAMEMENU) { game_state = old_game_state; } } else if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym == SDLK_F11) fps_text->is_visible() ? fps_text->hide() : fps_text->show(); else if (event->key.type == SDL_KEYDOWN && event->key.keysym.sym == SDLK_F12) toggle_fullscreen(); if (game_state == INGAMEMENU) { state_ingame_menu(event); } else if (game_state == VIEW_HELP) { state_view_help(event); } else if (game_state == MAINMENU) { state_mainmenu(event); } else if (game_state == HIGHSCORE) { state_highscore(event); } else if (game_state == GAMEOVER) { state_gameover(event); } else if (game_state == VIEW_HELP) { state_view_help(event); } else if (game_state == SET_HIGHSCORE) { state_set_highscore(event); } else if (game_state == GAMEPLAY_RUNNING || game_state == GAME_PAUSED) { state_gameplay_running(event); } }
static void shrinkwrap(void) { int w = fz_mini(page_tex.w + canvas_x, screen_w - SCREEN_FURNITURE_W); int h = fz_mini(page_tex.h + canvas_y, screen_h - SCREEN_FURNITURE_H); if (isfullscreen) toggle_fullscreen(); glfwSetWindowSize(window, w, h); }
/** * \brief The mouse has been pressed on the item. * \param button The pressed button. * \param pos The position of the mouse on the item. */ bool bear::system_fullscreen_toggle::mouse_pressed_local ( input::mouse::mouse_code button, const universe::position_type& pos ) { super::mouse_pressed_local( button, pos ); toggle_fullscreen(); return true; } // system_fullscreen_toggle::mouse_pressed_local()
gboolean on_key_press(GtkWidget* window, GdkEventKey* key, gpointer userdata) { if(key->type == GDK_KEY_PRESS && key->keyval == GDK_F5) { reload_browser(0); } else if(key->type == GDK_KEY_PRESS && key->keyval == GDK_F11) { toggle_fullscreen(0); } return FALSE; }
void MainWindow::setup_ui() { /* MENU BAR */ setMenuBar(&menu_bar); /* TOOL BAR */ // tool_bar.setIconSize(QSize(24, 24)); // addToolBar(Qt::TopToolBarArea, &tool_bar); /* CENTRAL WIDGET */ setCentralWidget(¢ral_widget); hbox_main.addLayout(&vbox_left, 1); hbox_main.addLayout(&vbox_right); vbox_left.addWidget(&draw_area, 0); vbox_right.addWidget(&spacer, 1); vbox_right.addWidget(&btn_run); vbox_right.addWidget(&btn_step); vbox_right.addLayout(&pixel_size_chooser.layout()); vbox_right.addLayout(&time_interval_chooser.layout()); ca_type_edit.widget().setText("Select ca"); vbox_right.addLayout(&ca_type_edit.layout()); btn_run.setCheckable(true); connect(&time_interval_chooser.widget(), SIGNAL(valueChanged(int)), &draw_area, SLOT(set_timeout_interval(int))); connect(&pixel_size_chooser.widget(), SIGNAL(valueChanged(int)), this, SLOT(change_pixel_size(int))); connect(&state_machine, SIGNAL(updated(StateMachine::STATE)), this, SLOT(state_updated(StateMachine::STATE))); connect(&btn_step, SIGNAL(released()), &state_machine, SLOT(trigger_step())); connect(&btn_run, SIGNAL(released()), &state_machine, SLOT(trigger_pause())); connect(&ca_type_edit.widget(), SIGNAL(clicked()), this, SLOT(change_ca_type())); connect(&menu_bar, SIGNAL(toggle_fullscreen()), this, SLOT(slot_fullscreen())); draw_area.fill_grid(); draw_area.set_pixel_size(pixel_size_chooser.widget().value()); /*pixel_size_chooser.widget().setMinimum(1); pixel_size_chooser.widget().setMaximum(255); pixel_size_chooser.widget().setValue(4); time_interval_chooser.widget().setMinimum(0); time_interval_chooser.widget().setMaximum(1000); time_interval_chooser.widget().setValue(10);*/ }
void MainWindow::setup_shortcuts(){ static struct Pair{ const char *command; const char *slot; } pairs[] = { #define SETUP_SHORTCUT(command, slot) { command, SLOT(slot)}, SETUP_SHORTCUT(quit_command, quit_slot()) SETUP_SHORTCUT(quit2_command, quit2_slot()) SETUP_SHORTCUT(next_command, next_slot()) SETUP_SHORTCUT(back_command, back_slot()) SETUP_SHORTCUT(background_swap_command, background_swap_slot()) SETUP_SHORTCUT(close_command, close_slot()) SETUP_SHORTCUT(zoom_in_command, zoom_in_slot()) SETUP_SHORTCUT(zoom_out_command, zoom_out_slot()) SETUP_SHORTCUT(reset_zoom_command, reset_zoom_slot()) SETUP_SHORTCUT(up_command, up_slot()) SETUP_SHORTCUT(down_command, down_slot()) SETUP_SHORTCUT(left_command, left_slot()) SETUP_SHORTCUT(right_command, right_slot()) SETUP_SHORTCUT(up_big_command, up_big_slot()) SETUP_SHORTCUT(down_big_command, down_big_slot()) SETUP_SHORTCUT(left_big_command, left_big_slot()) SETUP_SHORTCUT(right_big_command, right_big_slot()) SETUP_SHORTCUT(cycle_zoom_mode_command, cycle_zoom_mode_slot()) SETUP_SHORTCUT(toggle_lock_zoom_command, toggle_lock_zoom_slot()) SETUP_SHORTCUT(go_to_start_command, go_to_start()) SETUP_SHORTCUT(go_to_end_command, go_to_end()) SETUP_SHORTCUT(toggle_fullscreen_command, toggle_fullscreen()) SETUP_SHORTCUT(rotate_left_command, rotate_left()) SETUP_SHORTCUT(rotate_right_command, rotate_right()) SETUP_SHORTCUT(rotate_left_fine_command, rotate_left_fine()) SETUP_SHORTCUT(rotate_right_fine_command, rotate_right_fine()) SETUP_SHORTCUT(flip_h_command, flip_h()) SETUP_SHORTCUT(flip_v_command, flip_v()) SETUP_SHORTCUT(minimize_command, minimize_slot()) SETUP_SHORTCUT(minimize_all_command, minimize_all_slot()) SETUP_SHORTCUT(show_options_command, show_options_dialog()) }; for (auto &c : this->connections) this->disconnect(c); this->connections.clear(); this->shortcuts.clear(); auto &shortcuts = this->app->get_shortcuts(); for (auto &p : pairs){ auto setting = shortcuts.get_shortcut_setting(p.command); if (!setting) continue; for (auto &seq : setting->sequences) this->setup_shortcut(seq, p.slot); } }
static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { struct display *d = data; if (key == KEY_F11 && state) toggle_fullscreen(d->window, d->window->fullscreen ^ 1); else if (key == KEY_ESC && state) running = 0; }
static int my_toggle_fullscreen(int sel) { // int oldx = display_cfg.screen_x, oldy = display_cfg.screen_y; display_cfg.fullscreen ^= 1; toggle_fullscreen(); adjust_gui_resolution(); video_options->draw(); if (!(sdl_screen->flags & SDL_DOUBLEBUF) && !emulate_mouse_cursor) SDL_ShowCursor(SDL_ENABLE); clear_raine_screen(); video_options->draw(); return 0; // (oldx < display_cfg.screen_x || oldy < display_cfg.screen_y); }
/** * \brief The finger has been used on the item. * \param event The event dispatched by the finger. */ bool bear::system_fullscreen_toggle::finger_action_local ( const input::finger_event& event ) { super::finger_action_local( event ); if ( event.get_type() != input::finger_event::finger_event_pressed ) return false; toggle_fullscreen(); return true; } // system_fullscreen_toggle::finger_action_local()
static gboolean stage_button_press_cb (ClutterActor *stage, ClutterEvent *event, RBVisualizerPage *page) { if (event->button.button == 1 && event->button.click_count == 2) { clutter_threads_leave (); toggle_fullscreen (page); clutter_threads_enter (); } else if (event->button.button == 3) { rb_display_page_show_popup (RB_DISPLAY_PAGE (page)); } return FALSE; }
static gboolean player_av_button_press (GtkWidget *da, GdkEventButton *event, PlayerAV *self) { GdkRectangle rect; GdkScreen *screen = gdk_screen_get_default (); gint num = gdk_screen_get_n_monitors (screen); if (self->priv->monitor >= num) { self->priv->monitor = num-1; } if (event->button == 3) { GtkWidget *item; GtkWidget *menu = gtk_menu_new (); item = gtk_menu_item_new_with_label ("Toggle Fullscreen"); gtk_menu_append (GTK_MENU (menu), item); g_signal_connect (item, "activate", G_CALLBACK (toggle_fullscreen), self); gtk_menu_append (GTK_MENU (menu), gtk_separator_menu_item_new ()); GSList *group = NULL; gint i; for (i = 0; i < num; i++) { gdk_screen_get_monitor_geometry (screen, i, &rect); gchar *str = g_strdup_printf ("%d: %dx%d", i+1, rect.width, rect.height); item = gtk_radio_menu_item_new_with_label (group, str); g_free (str); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); if (i == self->priv->monitor) { gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); } gtk_menu_append (GTK_MENU (menu), item); g_signal_connect (item, "activate", G_CALLBACK (on_pick_screen), self); } gtk_menu_append (GTK_MENU (menu), gtk_separator_menu_item_new ()); gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time); } else if (event->type == GDK_2BUTTON_PRESS) { toggle_fullscreen (NULL, self); } return FALSE; }
static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { if (state == WL_KEYBOARD_KEY_STATE_RELEASED) return; if (key == KEY_ESC) { Core::Stop(); GLWin.running = 0; } else if ((key == KEY_P) || ((key == KEY_ENTER) && (GLWin.keyboard.modifiers == 0))) Core::SetState((Core::GetState() == Core::CORE_RUN) ? Core::CORE_PAUSE : Core::CORE_RUN); else if (key == KEY_F) toggle_fullscreen(!GLWin.fullscreen); else if ((key == KEY_ENTER) && (GLWin.keyboard.modifiers == MOD_ALT_MASK)) toggle_fullscreen(!GLWin.fullscreen); else if (key >= KEY_F1 && key <= KEY_F8) { int slot_number = key - KEY_F1 + 1; if (GLWin.keyboard.modifiers == MOD_SHIFT_MASK) State::Save(slot_number); else State::Load(slot_number); } else if (key == KEY_F9) Core::SaveScreenShot(); else if (key == KEY_F11) State::LoadLastSaved(); else if (key == KEY_F12) { if (GLWin.keyboard.modifiers == MOD_SHIFT_MASK) State::UndoLoadState(); else State::UndoSaveState(); } }
static bool create_window(unsigned window_width, unsigned window_height) { view.window_width = window_width; view.window_height = window_height; glutInitWindowSize (view.window_width, view.window_height); DEBUG("Creating window\n"); glutCreateWindow ("Conway's Game of Life"); DEBUG("Registering callbacks\n"); glutDisplayFunc (display_cb); glutKeyboardFunc (keyboard_cb); glutSpecialFunc (special_keyboard_cb); glutMotionFunc (motion_cb); glutMouseFunc (mouse_cb); glutReshapeFunc (reshape_cb); glutMouseWheelFunc (mousewheel_cb); DEBUG("Querying for OpenGL 2.1\n"); GLenum glew_err = glewInit(); if (glew_err != GLEW_OK) { fprintf(stderr, "Error: %s\n", glewGetErrorString(glew_err)); return false; } if (!GLEW_VERSION_2_1) { fprintf(stderr, "Error: Support for OpenGL 2.1 not found."); return false; } DEBUG("Setting up initial OpenGL state\n"); glClearColor(0.0f, 0.0f, 0.2f, 1.0f); glDisable(GL_DEPTH_TEST); glViewport(0, 0, view.window_width, view.window_height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, (GLdouble)view.window_width, 0.0, (GLdouble)view.window_height, 0.0, 1.0); check_gl_error(); if (view.fullscreen) { view.fullscreen = false; toggle_fullscreen(); } return true; }
void gui_display (int32_t shortcut) { pause_sound (); if (shortcut >=0 && shortcut < 4) { /* If we're running full-screen, we must toggle * to windowed mode before opening the dialog */ int32_t was_fullscreen; if (was_fullscreen = is_fullscreen ()) { toggle_fullscreen (0); if (is_fullscreen ()) { resume_sound (); return; } } (new floppyFilePanel (shortcut))->run (); if (was_fullscreen) toggle_fullscreen (0); } resume_sound (); }
void LasercakeGLWidget::key_change_(QKeyEvent* event, bool pressed) { if(event->isAutoRepeat()) { // If we someday allow key compression, this won't be a sensible way to stop auto-repeat: // "Note that if the event is a multiple-key compressed event that is partly due to auto-repeat, this function could return either true or false indeterminately." return; } if(pressed) { //TODO why handle window things here but other things in LasercakeController::key_changed? switch(event->key()) { case Qt::Key_Escape: ungrab_input_(); return; case Qt::Key_Q: case Qt::Key_W: if((event->modifiers() & Qt::ControlModifier)) { close(); return; } break; case Qt::Key_F11: toggle_fullscreen(); return; case Qt::Key_F: // F11 does Exposé stuff in OS X, and Command-Shift-F seems to be // the "fullscreen" convention there. // (Qt maps OSX command-key to Qt::Key_Control.) if((event->modifiers() & Qt::ShiftModifier) && (event->modifiers() & Qt::ControlModifier)) { toggle_fullscreen(); return; } break; } } const input_representation::key_type input_rep_key = q_key_event_to_input_rep_key_type(event); key_change_(event->key(), input_rep_key, pressed); }
gboolean key_press( GtkWidget *w, GdkEventKey *e, APP *app ) { switch( e->keyval ) { case 'f': toggle_fullscreen( app ); break; case 'q': quit( NULL, app ); break; } return FALSE; }
static gboolean key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { g_print("got key %c\n", event->keyval); switch (event->keyval){ case 'f': toggle_fullscreen(widget); break; case 'q': g_signal_emit_by_name(widget, "destroy"); break; default: break; } return TRUE; }
void ViewMenu::_call (int N) { logger.debug() << "selected choice " << N |0; switch (N) { case 0: projector->toggle_stereo(); break; case 1: projector->zoom(ZOOM_OUT); break; case 2: projector->zoom(ZOOM_IN); break; case 3: projector->pan_left (0.0625f); break; case 4: projector->pan_right(0.0625f); break; case 5: projector->pan_up (0.0625f); break; case 6: projector->pan_down (0.0625f); break; case 7: projector->pan_center(); break; case 8: toggle_fullscreen(); break; default: delete this; } }
void remote_button_action(gint button_num) { switch(button_num) { case RC_0: case RC_1: case RC_2: case RC_3: case RC_4: case RC_5: case RC_6: case RC_7: case RC_8: case RC_9: set_timeout_goto_channel(button_num - RC_0); break; case RC_MUTE: toggle_audio(); break; case RC_CHAN_UP: increase_channel(1); break; case RC_CHAN_DOWN: increase_channel(-1); break; case RC_FULLSCREEN: toggle_fullscreen(); break; case RC_SCREENSHOT: create_screenshot(); break; case RC_QUIT: if (!delete_event(NULL, NULL, NULL)) destroy(NULL, NULL); break; #ifdef OSS case RC_VOLUME_UP: set_volume(volume + 2); break; case RC_VOLUME_DOWN: set_volume(volume - 2); break; #endif case RC_PREVIOUS_CHAN: goto_previous_channel(); break; } }
static void goto_url(char *url) { #ifdef RAINE_UNIX // at least when using compiz, you can't switch to any other window while // in fullscreen mode, so it's better to leave it first ! if (display_cfg.fullscreen) toggle_fullscreen(); #endif char cmd[2048]; #ifdef RAINE_UNIX // Now use xdg-open instead of www-browser // normally xdg-open knows about urls and lanches the best application... sprintf(cmd,"xdg-open \"%s\" &",url); #else // windows sprintf(cmd,"explorer \"%s\"",url); #endif system(cmd); }
static gboolean key_press_event_cb(GtkWidget *widget, GdkEventKey *event, GstElement *pipeline) { switch (event->keyval) { case 'f': toggle_fullscreen(widget); break; case 'e': toggle_edges(pipeline); break; case 'q': g_signal_emit_by_name(widget, "destroy"); break; default: break; } return TRUE; }
/* Renders one frame and handles the SDL window */ void pn_render (void) { SDL_Event event; /* Handle window events */ while (SDL_PollEvent (&event)) { switch (event.type) { case SDL_QUIT: pn_quit (); g_assert_not_reached (); case SDL_KEYDOWN: switch (event.key.keysym.sym) { case SDLK_ESCAPE: pn_quit (); g_assert_not_reached (); case SDLK_RETURN: if (event.key.keysym.mod & (KMOD_ALT | KMOD_META)) toggle_fullscreen (); break; case SDLK_BACKQUOTE: take_screenshot (); break; default: break; } break; case SDL_VIDEORESIZE: resize_video (event.resize.w, event.resize.h); break; } } pn_new_beat = pn_is_new_beat(); if (pn_rc->actuator) { exec_actuator (pn_rc->actuator); blit_to_screen (); } }