Just some code maintenence. Like removing unused local vars.
PLS MERGE TO TRUNK.
git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/branches/Rambetter-temp-fixes@356
8a3a26a2-13c4-0310-b231-
cf6edde360e5
-static int in_file_dialog = 0;
-
typedef struct {
gboolean open;
OPENFILENAME *ofn;
BOOL dlgRtnVal;
typedef struct {
gboolean open;
OPENFILENAME *ofn;
BOOL dlgRtnVal;
} win32_native_file_dialog_comms_t;
DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam)
} win32_native_file_dialog_comms_t;
DWORD WINAPI win32_native_file_dialog_thread_func(LPVOID lpParam)
else {
fileDialogComms->dlgRtnVal = GetSaveFileName(fileDialogComms->ofn);
}
else {
fileDialogComms->dlgRtnVal = GetSaveFileName(fileDialogComms->ofn);
}
- fileDialogComms->done = -1; // No need to synchronize around lock.
+ fileDialogComms->done = true; // No need to synchronize around lock, one-way gate.
+ static bool in_file_dialog = false;
HANDLE fileDialogThreadHandle;
win32_native_file_dialog_comms_t fileDialogComms;
HANDLE fileDialogThreadHandle;
win32_native_file_dialog_comms_t fileDialogComms;
#endif
// Gtk dialog
GtkWidget* file_sel;
#endif
// Gtk dialog
GtkWidget* file_sel;
char *new_path = NULL;
const char* r;
char *new_path = NULL;
const char* r;
// do that the native way
if (in_file_dialog) return NULL; // Avoid recursive entry.
// do that the native way
if (in_file_dialog) return NULL; // Avoid recursive entry.
/* Set the members of the OPENFILENAME structure. */
// See http://msdn.microsoft.com/en-us/library/ms646839%28v=vs.85%29.aspx .
memset(&ofn, 0, sizeof(ofn));
/* Set the members of the OPENFILENAME structure. */
// See http://msdn.microsoft.com/en-us/library/ms646839%28v=vs.85%29.aspx .
memset(&ofn, 0, sizeof(ofn));
0, // dwCreationFlags
NULL); // lpThreadId
0, // dwCreationFlags
NULL); // lpThreadId
- // Avoid blocking indefinitely. Another thread will set fileDialogComms->done to nonzero;
+ // Avoid blocking indefinitely. Another thread will set fileDialogComms->done to true;
// we don't want to be in an indefinite blocked state when this happens. We want to break
// out of here eventually.
while (gtk_events_pending()) {
gtk_main_iteration();
}
if (dialogDone) break;
// we don't want to be in an indefinite blocked state when this happens. We want to break
// out of here eventually.
while (gtk_events_pending()) {
gtk_main_iteration();
}
if (dialogDone) break;
- if (fileDialogComms.done) dialogDone = 1; // One more loop of gtk_main_iteration() to get things in sync.
+ if (fileDialogComms.done) dialogDone = true; // One more loop of gtk_main_iteration() to get things in sync.
// Avoid tight infinte loop, add a small amount of sleep.
Sleep(10);
}
// Avoid tight infinte loop, add a small amount of sleep.
Sleep(10);
}
WaitForSingleObject(fileDialogThreadHandle, INFINITE);
CloseHandle(fileDialogThreadHandle);
WaitForSingleObject(fileDialogThreadHandle, INFINITE);
CloseHandle(fileDialogThreadHandle);
+ in_file_dialog = false;
if (!fileDialogComms.dlgRtnVal) {
return NULL; // Cancelled.
if (!fileDialogComms.dlgRtnVal) {
return NULL; // Cancelled.
#ifdef _WIN32
// win32 file dialog
#ifdef _WIN32
// win32 file dialog
- check = gtk_check_button_new_with_label (_("Use win32 file load dialog (hacky)"));
+ check = gtk_check_button_new_with_label (_("Use win32 file dialog (hacky)"));
gtk_widget_show (check);
// gtk_container_add (GTK_CONTAINER (vbox), check);
gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
gtk_widget_show (check);
// gtk_container_add (GTK_CONTAINER (vbox), check);
gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);