static void hildon_app_menu_realize (GtkWidget *widget) { Atom property, window_type; Display *xdisplay; GdkDisplay *gdkdisplay; GdkScreen *screen; GTK_WIDGET_CLASS (hildon_app_menu_parent_class)->realize (widget); gdk_window_set_decorations (widget->window, GDK_DECOR_BORDER); gdkdisplay = gdk_drawable_get_display (widget->window); xdisplay = GDK_WINDOW_XDISPLAY (widget->window); property = gdk_x11_get_xatom_by_name_for_display (gdkdisplay, "_NET_WM_WINDOW_TYPE"); window_type = XInternAtom (xdisplay, "_HILDON_WM_WINDOW_TYPE_APP_MENU", False); XChangeProperty (xdisplay, GDK_WINDOW_XID (widget->window), property, XA_ATOM, 32, PropModeReplace, (guchar *) &window_type, 1); /* Detect any screen changes */ screen = gtk_widget_get_screen (widget); g_signal_connect (screen, "size-changed", G_CALLBACK (screen_size_changed), widget); /* Force menu to set the initial layout */ screen_size_changed (screen, HILDON_APP_MENU (widget)); }
/* * gui_handle_events() * * This is called from the main UAE thread to process events sent from * the GUI thread. * * If the UAE emulation proper is not running yet or is paused, * this loops continuously waiting for and responding to events * until the emulation is started or resumed, respectively. When * the emulation is running, this is called periodically from * the main UAE event loop. */ void gui_handle_events (void) { /* Read GUI command if any. */ /* Process it, e.g., call uae_reset(). */ while (comm_pipe_has_data (&from_gui_pipe) || gui_pause_uae) { DEBUG_LOG("gui_handle_events: trying to read...\n"); int32_t cmd = read_comm_pipe_int_blocking (&from_gui_pipe); DEBUG_LOG("gui_handle_events: %i\n", cmd); switch (cmd) { case UAECMD_EJECTDISK: { int32_t n = read_comm_pipe_int_blocking (&from_gui_pipe); uae_sem_wait(&gui_sem); changed_prefs.floppyslots[n].df[0] = '\0'; uae_sem_post(&gui_sem); continue; } case UAECMD_INSERTDISK: { int32_t n = read_comm_pipe_int_blocking (&from_gui_pipe); if (using_restricted_cloanto_rom) { write_log("Loading other disks is not permitted under the " "license for the built-in Cloanto Kickstart " "ROM.\n"); continue; } uae_sem_wait(&gui_sem); strncpy (changed_prefs.floppyslots[n].df, new_disk_string[n], 255); free (new_disk_string[n]); new_disk_string[n] = 0; changed_prefs.floppyslots[n].df[255] = '\0'; uae_sem_post(&gui_sem); continue; } case UAECMD_RESET: uae_reset(1); break; // Stop GUI command processing until UAE is ready again. case UAECMD_PAUSE: gui_pause_uae = 1; continue; case UAECMD_RESUME: gui_pause_uae = 0; continue; case UAECMD_SELECT_ROM: uae_sem_wait(&gui_sem); strncpy(changed_prefs.romfile, gui_romname, 255); changed_prefs.romfile[255] = '\0'; free(gui_romname); gui_romname = 0; /* Switching to non-restricted ROM; rebooting. */ using_restricted_cloanto_rom = 0; uae_reset(1); uae_sem_post(&gui_sem); continue; case UAECMD_RESIZE: { int32_t width = read_comm_pipe_int_blocking(&from_gui_pipe); int32_t height = read_comm_pipe_int_blocking(&from_gui_pipe); screen_size_changed(width, height); continue; } default: DEBUG_LOG("Unknown command %d received from GUI.\n", cmd); continue; } } }