diff options
author | Robin Gareus <robin@gareus.org> | 2019-04-13 17:48:27 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-04-13 17:57:46 +0200 |
commit | 31815b5f268fa0233cd25b7ff2c8a246c12c20d1 (patch) | |
tree | cd80e3a8335ba5c27ac0709e2f12ffd4057cf71e /gtk2_ardour/linux_vst_gui_support.cc | |
parent | 90a7bef656d9cf76825db3c30c489b93cf9c8894 (diff) |
NO-OP: whitespace
This fixes mostly <tab> after <space> and similar <tab> not used
for indenting as well as some related code alignment issues.
Diffstat (limited to 'gtk2_ardour/linux_vst_gui_support.cc')
-rw-r--r-- | gtk2_ardour/linux_vst_gui_support.cc | 179 |
1 files changed, 90 insertions, 89 deletions
diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc index 8dc2e928e4..15dd834360 100644 --- a/gtk2_ardour/linux_vst_gui_support.cc +++ b/gtk2_ardour/linux_vst_gui_support.cc @@ -71,7 +71,7 @@ static pthread_t LXVST_gui_event_thread; static bool LXVST_xerror; -int TempErrorHandler(Display *display, XErrorEvent *e) +int TempErrorHandler (Display *display, XErrorEvent *e) { LXVST_xerror = true; @@ -80,14 +80,14 @@ int TempErrorHandler(Display *display, XErrorEvent *e) #ifdef LXVST_32BIT -int getXWindowProperty(Window window, Atom atom) +int getXWindowProperty (Window window, Atom atom) { int result = 0; int userSize; unsigned long bytes; unsigned long userCount; unsigned char *data; - Atom userType; + Atom userType; LXVST_xerror = false; /*Use our own Xerror handler while we're in here - in an @@ -95,25 +95,26 @@ int getXWindowProperty(Window window, Atom atom) qutting the entire application because of e.g. an invalid window ID*/ - XErrorHandler olderrorhandler = XSetErrorHandler(TempErrorHandler); - - XGetWindowProperty( LXVST_XDisplay, //The display - window, //The Window - atom, //The property - 0, //Offset into the data - 1, //Number of 32Bit chunks of data - false, //false = don't delete the property - AnyPropertyType, //Required property type mask - &userType, //Actual type returned - &userSize, //Actual format returned - &userCount, //Actual number of items stored in the returned data - &bytes, //Number of bytes remaining if a partial read - &data); //The actual data read - - if(LXVST_xerror == false && userCount == 1) - result = *(int*)data; + XErrorHandler olderrorhandler = XSetErrorHandler (TempErrorHandler); + + XGetWindowProperty (LXVST_XDisplay, // The display + window, // The Window + atom, // The property + 0, // Offset into the data + 1, // Number of 32Bit chunks of data + false, // false = don't delete the property + AnyPropertyType, // Required property type mask + &userType, // Actual type returned + &userSize, // Actual format returned + &userCount, // Actual number of items stored in the returned data + &bytes, // Number of bytes remaining if a partial read + &data); // The actual data read + + if (LXVST_xerror == false && userCount == 1) { + result = *(int*)data; + } - XSetErrorHandler(olderrorhandler); + XSetErrorHandler (olderrorhandler); /*Hopefully this will return zero if the property is not set*/ @@ -129,40 +130,42 @@ int getXWindowProperty(Window window, Atom atom) /* system of passing an eventProc address */ /********************************************************************/ -long getXWindowProperty(Window window, Atom atom) +long getXWindowProperty (Window window, Atom atom) { long result = 0; int userSize; unsigned long bytes; unsigned long userCount; unsigned char *data; - Atom userType; + Atom userType; LXVST_xerror = false; /*Use our own Xerror handler while we're in here - in an - attempt to stop the brain dead default Xerror behaviour of - qutting the entire application because of e.g. an invalid - window ID*/ - - XErrorHandler olderrorhandler = XSetErrorHandler(TempErrorHandler); - - XGetWindowProperty( LXVST_XDisplay, - window, - atom, - 0, - 2, - false, - AnyPropertyType, - &userType, - &userSize, - &userCount, - &bytes, - &data); + * attempt to stop the brain dead default Xerror behaviour of + * qutting the entire application because of e.g. an invalid + * window ID + */ - if(LXVST_xerror == false && userCount == 1) - result = *(long*)data; + XErrorHandler olderrorhandler = XSetErrorHandler (TempErrorHandler); + + XGetWindowProperty (LXVST_XDisplay, + window, + atom, + 0, + 2, + false, + AnyPropertyType, + &userType, + &userSize, + &userCount, + &bytes, + &data); + + if (LXVST_xerror == false && userCount == 1) { + result = *(long*)data; + } - XSetErrorHandler(olderrorhandler); + XSetErrorHandler (olderrorhandler); /*Hopefully this will return zero if the property is not set*/ @@ -179,7 +182,7 @@ dispatch_x_events (XEvent* event, VSTState* vstfx) { /*Handle some of the Events we might be interested in*/ - switch(event->type) + switch (event->type) { /*Configure event - when the window is resized or first drawn*/ @@ -199,7 +202,7 @@ dispatch_x_events (XEvent* event, VSTState* vstfx) if (window == (Window) (vstfx->linux_window)) { #ifndef NDEBUG - printf("dispatch_x_events: ConfigureNotify cfg:(%d %d) plugin:(%d %d)\n", + printf ("dispatch_x_events: ConfigureNotify cfg: (%d %d) plugin: (%d %d)\n", width, height, vstfx->width, vstfx->height ); @@ -246,7 +249,7 @@ dispatch_x_events (XEvent* event, VSTState* vstfx) vstfx->linux_plugin_ui_window = PluginUIWindowID; #ifdef LXVST_32BIT - int result = getXWindowProperty(PluginUIWindowID, XInternAtom(LXVST_XDisplay, "_XEventProc", false)); + int result = getXWindowProperty (PluginUIWindowID, XInternAtom (LXVST_XDisplay, "_XEventProc", false)); if (result == 0) { vstfx->eventProc = NULL; @@ -255,12 +258,13 @@ dispatch_x_events (XEvent* event, VSTState* vstfx) } #endif #ifdef LXVST_64BIT - long result = getXWindowProperty(PluginUIWindowID, XInternAtom(LXVST_XDisplay, "_XEventProc", false)); + long result = getXWindowProperty (PluginUIWindowID, XInternAtom (LXVST_XDisplay, "_XEventProc", false)); - if(result == 0) + if (result == 0) { vstfx->eventProc = NULL; - else + } else { vstfx->eventProc = (void (*) (void* event))result; + } #endif } break; @@ -276,15 +280,15 @@ dispatch_x_events (XEvent* event, VSTState* vstfx) to effEditOpen when the editor is launched*/ if (window == (Window) (vstfx->linux_window)) { - char* message = XGetAtomName(LXVST_XDisplay, message_type); + char* message = XGetAtomName (LXVST_XDisplay, message_type); - if (strcmp(message,"LaunchEditor") == 0) { + if (strcmp (message,"LaunchEditor") == 0) { if (event->xclient.data.l[0] == 0x0FEEDBAC) { vstfx_launch_editor (vstfx); } } - XFree(message); + XFree (message); } break; } @@ -306,7 +310,7 @@ dispatch_x_events (XEvent* event, VSTState* vstfx) return; } - vstfx->eventProc((void*)event); + vstfx->eventProc ((void*)event); } /** This is the main gui event loop for the plugin, we also need to pass @@ -333,11 +337,10 @@ void* gui_event_loop (void* ptr) bool may_sleep = true; - if(LXVST_XDisplay) - { + if (LXVST_XDisplay) { /*See if there are any events in the queue*/ - int num_events = XPending(LXVST_XDisplay); + int num_events = XPending (LXVST_XDisplay); if (num_events > 0) { // keep dispatching events as fast as possible @@ -346,19 +349,17 @@ void* gui_event_loop (void* ptr) /*process them if there are any*/ - while(num_events) - { - XNextEvent(LXVST_XDisplay, &event); + while (num_events) { + XNextEvent (LXVST_XDisplay, &event); /*Call dispatch events, with the event, for each plugin in the linked list*/ - for (vstfx = vstfx_first; vstfx; vstfx = vstfx->next) - { - pthread_mutex_lock(&vstfx->lock); + for (vstfx = vstfx_first; vstfx; vstfx = vstfx->next) { + pthread_mutex_lock (&vstfx->lock); - dispatch_x_events(&event, vstfx); + dispatch_x_events (&event, vstfx); - pthread_mutex_unlock(&vstfx->lock); + pthread_mutex_unlock (&vstfx->lock); } num_events--; @@ -367,16 +368,15 @@ void* gui_event_loop (void* ptr) /*We don't want to use all the CPU.. */ - Glib::usleep(1000); + Glib::usleep (1000); /*See if its time for us to do a scheduled event pass on all the plugins*/ clock2 = g_get_monotonic_time(); const int64_t elapsed_time_ms = (clock2 - clock1) / 1000; - if((LXVST_sched_timer_interval != 0) && elapsed_time_ms >= LXVST_sched_timer_interval) - { - //printf("elapsed %d ms ^= %.2f Hz\n", elapsed_time_ms, 1000.0/(double)elapsed_time_ms); // DEBUG + if ((LXVST_sched_timer_interval != 0) && elapsed_time_ms >= LXVST_sched_timer_interval) { + //printf ("elapsed %d ms ^= %.2f Hz\n", elapsed_time_ms, 1000.0/ (double)elapsed_time_ms); // DEBUG pthread_mutex_lock (&plugin_mutex); again: @@ -417,7 +417,7 @@ again: pthread_mutex_unlock (&vstfx->lock); goto again; } else { - /* condition/unlock: it was signalled & unlocked in fst_create_editor() */ + /* condition/unlock: it was signalled & unlocked in fst_create_editor() */ } } @@ -445,8 +445,9 @@ again: vstfx->plugin->dispatcher (vstfx->plugin, effEditIdle, 0, 0, NULL, 0); - if(vstfx->wantIdle) + if (vstfx->wantIdle) { vstfx->plugin->dispatcher (vstfx->plugin, 53, 0, 0, NULL, 0); + } pthread_mutex_unlock (&vstfx->lock); } @@ -456,12 +457,12 @@ again: } if (!gui_quit && may_sleep && elapsed_time_ms + 1 < LXVST_sched_timer_interval) { - Glib::usleep(1000 * (LXVST_sched_timer_interval - elapsed_time_ms - 1)); + Glib::usleep (1000 * (LXVST_sched_timer_interval - elapsed_time_ms - 1)); } } if (LXVST_XDisplay) { - XCloseDisplay(LXVST_XDisplay); + XCloseDisplay (LXVST_XDisplay); LXVST_XDisplay = 0; } @@ -506,12 +507,12 @@ int vstfx_init (void* ptr) /*Init the attribs to defaults*/ - pthread_attr_init(&thread_attributes); + pthread_attr_init (&thread_attributes); /*Make sure the thread is joinable - this should be the default anyway - so we can join to it on vstfx_exit*/ - pthread_attr_setdetachstate(&thread_attributes, PTHREAD_CREATE_JOINABLE); + pthread_attr_setdetachstate (&thread_attributes, PTHREAD_CREATE_JOINABLE); /*This is where we need to open a connection to X, and start the GUI thread*/ @@ -520,13 +521,13 @@ int vstfx_init (void* ptr) will talk to X down this connection - X cannot handle multi-threaded access via the same Display* */ - if(LXVST_XDisplay==NULL) - LXVST_XDisplay = XOpenDisplay(NULL); //We might be able to make this open a specific screen etc + if (LXVST_XDisplay == NULL) { + LXVST_XDisplay = XOpenDisplay (NULL); //We might be able to make this open a specific screen etc + } /*Drop out and report the error if we fail to connect to X */ - if(LXVST_XDisplay==NULL) - { + if (LXVST_XDisplay == NULL) { vstfx_error ("** ERROR ** VSTFX: Failed opening connection to X"); return -1; @@ -536,15 +537,15 @@ int vstfx_init (void* ptr) /*Create the thread - use default attrs for now, don't think we need anything special*/ - thread_create_result = pthread_create(&LXVST_gui_event_thread, &thread_attributes, gui_event_loop, NULL); + thread_create_result = pthread_create (&LXVST_gui_event_thread, &thread_attributes, gui_event_loop, NULL); - if(thread_create_result!=0) + if (thread_create_result != 0) { /*There was a problem starting the GUI event thread*/ vstfx_error ("** ERROR ** VSTFX: Failed starting GUI event thread"); - XCloseDisplay(LXVST_XDisplay); + XCloseDisplay (LXVST_XDisplay); LXVST_XDisplay = 0; gui_quit = 1; @@ -556,7 +557,7 @@ int vstfx_init (void* ptr) /*The vstfx Quit function*/ -void vstfx_exit() +void vstfx_exit () { if (gui_quit) { return; @@ -679,8 +680,8 @@ int vstfx_create_editor (VSTState* vstfx) event.window = parent_window; event.message_type = WindowActiveAtom; - event.format = 32; //Data format - event.data.l[0] = 0x0FEEDBAC; //Something we can recognize later + event.format = 32; //Data format + event.data.l[0] = 0x0FEEDBAC; //Something we can recognize later /*Push the event into the queue on our Display*/ @@ -727,7 +728,7 @@ vstfx_launch_editor (VSTState* vstfx) /* linuxDSP VSTs don't use the host Display* at all */ /**************************************************************/ - vstfx->plugin->dispatcher (vstfx->plugin, effEditOpen, 0, (long)LXVST_XDisplay, (void*)(parent_window), 0 ); + vstfx->plugin->dispatcher (vstfx->plugin, effEditOpen, 0, (long)LXVST_XDisplay, (void*)(parent_window), 0); /*QUIRK - some plugins need a slight delay after opening the editor before you can ask the window size or they might return zero - specifically discoDSP */ @@ -736,7 +737,7 @@ vstfx_launch_editor (VSTState* vstfx) /*Now we can find out how big the parent window should be (and try) to resize it*/ - vstfx->plugin->dispatcher (vstfx->plugin, effEditGetRect, 0, 0, &er, 0 ); + vstfx->plugin->dispatcher (vstfx->plugin, effEditGetRect, 0, 0, &er, 0); if (er) { // Don't crash is plugin does not implement effEditGetRect @@ -748,7 +749,7 @@ vstfx_launch_editor (VSTState* vstfx) vstfx->width = x_size; vstfx->height = y_size; - XResizeWindow(LXVST_XDisplay, parent_window, x_size, y_size); + XResizeWindow (LXVST_XDisplay, parent_window, x_size, y_size); XFlush (LXVST_XDisplay); @@ -801,7 +802,7 @@ vstfx_event_loop_remove_plugin (VSTState* vstfx) // if this function is called, there must be // at least one plugin in the linked list - assert(vstfx_first); + assert (vstfx_first); if (vstfx_first == vstfx) { vstfx_first = vstfx_first->next; |