void Input::end_frame() { auto device = core::get_subsystem<graphics::WindowDevice>(); // _window_size = core::get_subsystem<graphics::WindowDevice>()->get_window_size(); _last_mouse_position = get_mouse_position(); // check for focus change this frame if( device->get_window_flags() & SDL_WINDOW_INPUT_FOCUS ) { if( !_input_focus ) { reset_state(); if( !_mouse_visible ) SDL_ShowCursor(SDL_FALSE); } _input_focus = true; } else { if( _input_focus ) { reset_state(); SDL_ShowCursor(SDL_TRUE); } _input_focus = false; } // recenter mouse if no mouse visibility if( _input_focus && !_mouse_visible && !_touch_emulation ) { SDL_WarpMouseInWindow((SDL_Window*)device->get_window_object(), _window_size[0]/2, _window_size[1]/2); } }
static GtkWidget* preview_collection (int font_size, PangoFontDescription *base_desc) { GtkWidget *box; GtkWidget *sw; GdkColor desktop_color; int i; GtkWidget *eventbox; sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); box = gtk_vbox_new (FALSE, 0); gtk_box_set_spacing (GTK_BOX (box), 20); gtk_container_set_border_width (GTK_CONTAINER (box), 20); eventbox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (eventbox), box); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), eventbox); desktop_color.red = 0x5144; desktop_color.green = 0x75D6; desktop_color.blue = 0xA699; gtk_widget_modify_bg (eventbox, GTK_STATE_NORMAL, &desktop_color); i = 0; while (i < META_FRAME_TYPE_LAST) { const char *title = NULL; GtkWidget *contents; GtkWidget *align; double xalign, yalign; GtkWidget *eventbox2; GtkWidget *preview; PangoFontDescription *font_desc; double scale; eventbox2 = gtk_event_box_new (); preview = meta_preview_new (); gtk_container_add (GTK_CONTAINER (eventbox2), preview); meta_preview_set_frame_type (META_PREVIEW (preview), i); meta_preview_set_frame_flags (META_PREVIEW (preview), get_window_flags (i)); meta_preview_set_theme (META_PREVIEW (preview), global_theme); contents = get_window_contents (i, &title); meta_preview_set_title (META_PREVIEW (preview), title); gtk_container_add (GTK_CONTAINER (preview), contents); if (i == META_FRAME_TYPE_MENU) { xalign = 0.0; yalign = 0.0; } else { xalign = 0.5; yalign = 0.5; } align = gtk_alignment_new (0.0, 0.0, xalign, yalign); gtk_container_add (GTK_CONTAINER (align), eventbox2); gtk_box_pack_start (GTK_BOX (box), align, TRUE, TRUE, 0); switch (font_size) { case FONT_SIZE_SMALL: scale = PANGO_SCALE_XX_SMALL; break; case FONT_SIZE_LARGE: scale = PANGO_SCALE_XX_LARGE; break; default: scale = 1.0; break; } if (scale != 1.0) { font_desc = pango_font_description_new (); pango_font_description_set_size (font_desc, MAX (pango_font_description_get_size (base_desc) * scale, 1)); gtk_widget_modify_font (preview, font_desc); pango_font_description_free (font_desc); } previews[font_size*META_FRAME_TYPE_LAST + i] = preview; ++i; } return sw; }