void takeDownSplash() { if(topWindow != NULL) { DestroyWindow(topWindow); dispatchMessages(); topWindow = 0; } }
void takeDownSplash() { if(shellHandle != 0) { gtk.gtk_widget_destroy(shellHandle); dispatchMessages(); splashHandle = 0; shellHandle = NULL; } }
void Connection::SyncMessageState::dispatchMessageAndResetDidScheduleDispatchMessagesForConnection(Connection* connection) { { MutexLocker locker(m_mutex); ASSERT(m_didScheduleDispatchMessagesWorkSet.contains(connection)); m_didScheduleDispatchMessagesWorkSet.remove(connection); } dispatchMessages(connection); }
void takeDownSplash() { if(shellHandle != 0) { gtk.gtk_widget_destroy(shellHandle); if (image != NULL) { gtk.gtk_widget_destroy(image); gtk.g_object_unref(pixbuf); } dispatchMessages(); splashHandle = 0; shellHandle = NULL; } }
JavaResults* launchJavaVM( char* args[] ) { JavaResults* jvmResults = NULL; pid_t jvmProcess, finishedProcess = 0; int exitCode; #ifdef MOZILLA_FIX fixEnvForMozilla(); #endif /* MOZILLA_FIX */ jvmProcess = fork(); if (jvmProcess == 0) { /* Child process ... start the JVM */ execv(args[0], args); /* The JVM would not start ... return error code to parent process. */ /* TODO, how to distinguish this as a launch problem to the other process? */ _exit(errno); } jvmResults = malloc(sizeof(JavaResults)); memset(jvmResults, 0, sizeof(JavaResults)); /* If the JVM is still running, wait for it to terminate. */ if (jvmProcess != 0) { /* When attempting a file open, we need to spin the event loop * for setAppWindowTimerProc to run. When that succeeds or times out, * we can stop the event loop and just wait on the child process. */ if (openFilePath != NULL) { struct timespec sleepTime; sleepTime.tv_sec = 0; sleepTime.tv_nsec = 5e+8; // 500 milliseconds while(openFileTimeout > 0 && !windowPropertySet && (finishedProcess = waitpid(jvmProcess, &exitCode, WNOHANG)) == 0) { dispatchMessages(); nanosleep(&sleepTime, NULL); } } if (finishedProcess == 0) waitpid(jvmProcess, &exitCode, 0); if (WIFEXITED(exitCode)) /* TODO, this should really be a runResult if we could distinguish the launch problem above */ jvmResults->launchResult = WEXITSTATUS(exitCode); } return jvmResults; }
/* Create and Display the Splash Window */ int showSplash( const char* featureImage ) { GtkWidget *image; GdkPixbuf *pixbuf; if (splashHandle != 0) return 0; /* already showing splash */ if (featureImage == NULL) return -1; if (initialArgv == NULL) initialArgc = 0; if( initWindowSystem(&initialArgc, initialArgv, 1) != 0) return -1; shellHandle = gtk.gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk.gtk_window_set_decorated((GtkWindow*)(shellHandle), FALSE); gtk.g_signal_connect_data((gpointer)shellHandle, "destroy", (GtkSignalFunc)(gtk.gtk_widget_destroyed), &shellHandle, NULL, 0); pixbuf = gtk.gdk_pixbuf_new_from_file(featureImage, NULL); image = gtk.gtk_image_new_from_pixbuf(pixbuf); if (pixbuf) { gtk.g_object_unref(pixbuf); } gtk.gtk_container_add((GtkContainer*)(shellHandle), image); if (getOfficialName() != NULL) gtk.gtk_window_set_title((GtkWindow*)(shellHandle), getOfficialName()); gtk.gtk_window_set_position((GtkWindow*)(shellHandle), GTK_WIN_POS_CENTER); gtk.gtk_window_resize((GtkWindow*)(shellHandle), gtk.gdk_pixbuf_get_width(pixbuf), gtk.gdk_pixbuf_get_height(pixbuf)); gtk.gtk_widget_show_all((GtkWidget*)(shellHandle)); splashHandle = (long)shellHandle; dispatchMessages(); return 0; }
/* Show the Splash Window * * Open the bitmap, insert into the splash window and display it. * */ int showSplash( const _TCHAR* featureImage ) { static int splashing = 0; HBITMAP hBitmap = 0; BITMAP bmp; HDC hDC; int depth; int x, y; int width, height; int dpiX, scaledWidth, scaledHeight; if(splashing) { /*splash screen is already showing, do nothing */ return 0; } if (featureImage == NULL) return -1; /* if Java was started first and is calling back to show the splash, we might not * have initialized the window system yet */ initWindowSystem(0, NULL, 1); /* Load the bitmap for the feature. */ hDC = GetDC( NULL); depth = GetDeviceCaps( hDC, BITSPIXEL ) * GetDeviceCaps( hDC, PLANES); /* fetch screen DPI and round it to 100% multiples, this implementation needs to be kept in sync with org.eclipse.swt.internal.DPIUtil#setDeviceZoom(int) */ dpiX = GetDeviceCaps ( hDC, LOGPIXELSX ); dpiX = ((int)((dpiX + 24) / 96 )) * 96; ReleaseDC(NULL, hDC); if (featureImage != NULL) hBitmap = LoadImage(NULL, featureImage, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); /* If the bitmap could not be found, return an error. */ if (hBitmap == 0) return ERROR_FILE_NOT_FOUND; GetObject(hBitmap, sizeof(BITMAP), &bmp); /* reload scaled up image when zoom > 100% */ if (dpiX > 96) { /* calculate scaled-up bounds */ scaledWidth = dpiX * bmp.bmWidth / 96; scaledHeight = dpiX * bmp.bmHeight / 96; hBitmap = LoadImage(NULL, featureImage, IMAGE_BITMAP, scaledWidth, scaledHeight, LR_LOADFROMFILE); /* If the bitmap could not be found, return an error. */ if (hBitmap == 0) return ERROR_FILE_NOT_FOUND; GetObject(hBitmap, sizeof(BITMAP), &bmp); } /* figure out position */ width = GetSystemMetrics (SM_CXSCREEN); height = GetSystemMetrics (SM_CYSCREEN); x = (width - bmp.bmWidth) / 2; y = (height - bmp.bmHeight) / 2; /* Centre the splash window and display it. */ SetWindowPos (topWindow, 0, x, y, bmp.bmWidth, bmp.bmHeight, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); SendMessage( topWindow, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBitmap ); ShowWindow( topWindow, SW_SHOW ); BringWindowToTop( topWindow ); splashing = 1; /* Process messages */ dispatchMessages(); return 0; }
/* Create and Display the Splash Window */ int showSplash( const char* featureImage ) { GtkAdjustment* vadj, *hadj; int width, height; guint handlerId; GtkWidget* vboxHandle, * scrolledHandle, * handle; if (splashHandle != 0) return 0; /* already showing splash */ if (featureImage == NULL) return -1; if (initialArgv == NULL) initialArgc = 0; if( initWindowSystem(&initialArgc, initialArgv, 1) != 0) return -1; shellHandle = gtk.gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk.gtk_window_set_decorated((GtkWindow*)(shellHandle), FALSE); gtk.gtk_signal_connect((GtkObject*)shellHandle, "destroy", (GtkSignalFunc)(gtk.gtk_widget_destroyed), &shellHandle); vboxHandle = gtk.gtk_vbox_new(FALSE, 0); if(vboxHandle == 0) return -1; vadj = (GtkAdjustment*)gtk.gtk_adjustment_new(0, 0, 100, 1, 10, 10); hadj = (GtkAdjustment*)gtk.gtk_adjustment_new(0, 0, 100, 1, 10, 10); if (vadj == 0 || hadj == 0) return -1; scrolledHandle = gtk.gtk_scrolled_window_new(hadj, vadj); gtk.gtk_container_add((GtkContainer*)(vboxHandle), scrolledHandle); gtk.gtk_box_set_child_packing((GtkBox*)(vboxHandle), scrolledHandle, TRUE, TRUE, 0, GTK_PACK_END); gtk.gtk_scrolled_window_set_policy((GtkScrolledWindow*)(scrolledHandle), GTK_POLICY_NEVER, GTK_POLICY_NEVER); handle = gtk.gtk_fixed_new(); gtk.gtk_fixed_set_has_window((GtkFixed*)(handle), TRUE); ((GtkObject*)handle)->flags |= GTK_CAN_FOCUS; /*GTK_WIDGET_SET_FLAGS(handle, GTK_CAN_FOCUS);*/ /* avoid gtk_scrolled_window_add warning */ handlerId = gtk.g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, &log_handler, NULL); gtk.gtk_container_add((GtkContainer*)(scrolledHandle), handle); gtk.g_log_remove_handler("Gtk", handlerId); gtk.gtk_container_add((GtkContainer*)(shellHandle), vboxHandle); pixbuf = gtk.gdk_pixbuf_new_from_file(featureImage, NULL); image = gtk.gtk_image_new_from_pixbuf(pixbuf); gtk.gtk_signal_connect((GtkObject*)(image), "destroy", (GtkSignalFunc)(gtk.gtk_widget_destroyed), &image); gtk.gtk_container_add((GtkContainer*)(handle), image); width = gtk.gdk_pixbuf_get_width(pixbuf); height = gtk.gdk_pixbuf_get_height(pixbuf); gtk.gtk_window_set_position((GtkWindow*)(shellHandle), GTK_WIN_POS_CENTER); if (getOfficialName() != NULL) gtk.gtk_window_set_title((GtkWindow*)(shellHandle), getOfficialName()); gtk.gtk_window_resize((GtkWindow*)(shellHandle), width, height); gtk.gtk_widget_show_all((GtkWidget*)(shellHandle)); splashHandle = (long)shellHandle; dispatchMessages(); return 0; }