On Thu, Oct 30, 2014 at 02:08:32PM +0100, Marc-André Lureau wrote: > I would rather not do that massive tab cleanup, because it is a pain in > reading history with git blame. Well, it's a one off pain as then new tabs should not be introduced, and this just adds one extra step when using git annotate. This avoids having to cope with mixed tabs/spaces in the future, so worth it imo. Not really important, it's easy to skip that test in make syntax-check, I'll disable it. Christophe > > On Thu, Oct 30, 2014 at 1:56 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> > wrote: > > > Some source files inconsistently use space VS tabs. Most of the codebase > > uses 8 spaces for indentation, this commit changes the remaining tabs to > > spaces. > > --- > > gtk/channel-display.h | 2 +- > > gtk/channel-main.c | 14 +- > > gtk/channel-record.h | 2 +- > > gtk/continuation.c | 66 ++++----- > > gtk/continuation.h | 18 +-- > > gtk/controller/namedpipe.c | 14 +- > > gtk/controller/namedpipeconnection.c | 6 +- > > gtk/coroutine.h | 24 ++-- > > gtk/coroutine_gthread.c | 166 +++++++++++------------ > > gtk/coroutine_ucontext.c | 106 +++++++-------- > > gtk/coroutine_winfibers.c | 98 +++++++------- > > gtk/gio-coroutine.c | 10 +- > > gtk/glib-compat.c | 2 +- > > gtk/glib-compat.h | 6 +- > > gtk/spice-audio.h | 6 +- > > gtk/spice-channel.c | 2 +- > > gtk/spice-grabsequence.c | 94 ++++++------- > > gtk/spice-grabsequence.h | 6 +- > > gtk/spice-gtk-session.c | 6 +- > > gtk/spice-session.c | 36 ++--- > > gtk/spice-util.c | 2 +- > > gtk/spice-widget.h | 8 +- > > gtk/spicy-screenshot.c | 4 +- > > gtk/spicy.c | 12 +- > > gtk/vncdisplaykeymap.c | 250 > > +++++++++++++++++------------------ > > 25 files changed, 480 insertions(+), 480 deletions(-) > > > > diff --git a/gtk/channel-display.h b/gtk/channel-display.h > > index 88e60d9..10c2813 100644 > > --- a/gtk/channel-display.h > > +++ b/gtk/channel-display.h > > @@ -93,7 +93,7 @@ struct _SpiceDisplayChannelClass { > > /*< private >*/ > > }; > > > > -GType spice_display_channel_get_type(void); > > +GType spice_display_channel_get_type(void); > > gboolean spice_display_get_primary(SpiceChannel *channel, guint32 > > surface_id, > > SpiceDisplayPrimary *primary); > > > > diff --git a/gtk/channel-main.c b/gtk/channel-main.c > > index 1ad090f..14899b9 100644 > > --- a/gtk/channel-main.c > > +++ b/gtk/channel-main.c > > @@ -256,13 +256,13 @@ static void spice_main_get_property(GObject > > *object, > > switch (prop_id) { > > case PROP_MOUSE_MODE: > > g_value_set_int(value, c->mouse_mode); > > - break; > > + break; > > case PROP_AGENT_CONNECTED: > > g_value_set_boolean(value, c->agent_connected); > > - break; > > + break; > > case PROP_AGENT_CAPS_0: > > g_value_set_int(value, c->agent_caps[0]); > > - break; > > + break; > > case PROP_DISPLAY_DISABLE_WALLPAPER: > > g_value_set_boolean(value, c->display_disable_wallpaper); > > break; > > @@ -285,8 +285,8 @@ static void spice_main_get_property(GObject *object, > > g_value_set_int(value, spice_main_get_max_clipboard(self)); > > break; > > default: > > - G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); > > - break; > > + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); > > + break; > > } > > } > > > > @@ -322,8 +322,8 @@ static void spice_main_set_property(GObject *gobject, > > guint prop_id, > > spice_main_set_max_clipboard(self, g_value_get_int(value)); > > break; > > default: > > - G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > > - break; > > + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > > + break; > > } > > } > > > > diff --git a/gtk/channel-record.h b/gtk/channel-record.h > > index 20a9ad3..31c0f7b 100644 > > --- a/gtk/channel-record.h > > +++ b/gtk/channel-record.h > > @@ -68,7 +68,7 @@ struct _SpiceRecordChannelClass { > > /* Do not add fields to this struct */ > > }; > > > > -GType spice_record_channel_get_type(void); > > +GType spice_record_channel_get_type(void); > > void spice_record_send_data(SpiceRecordChannel *channel, > > gpointer data, > > gsize bytes, guint32 time); > > > > diff --git a/gtk/continuation.c b/gtk/continuation.c > > index adce858..3c348a9 100644 > > --- a/gtk/continuation.c > > +++ b/gtk/continuation.c > > @@ -35,63 +35,63 @@ > > * union is a quick hack to let us do that > > */ > > union cc_arg { > > - void *p; > > - int i[2]; > > + void *p; > > + int i[2]; > > }; > > > > static void continuation_trampoline(int i0, int i1) > > { > > - union cc_arg arg; > > - struct continuation *cc; > > - arg.i[0] = i0; > > - arg.i[1] = i1; > > - cc = arg.p; > > + union cc_arg arg; > > + struct continuation *cc; > > + arg.i[0] = i0; > > + arg.i[1] = i1; > > + cc = arg.p; > > > > - if (_setjmp(cc->jmp) == 0) { > > - ucontext_t tmp; > > - swapcontext(&tmp, &cc->last); > > - } > > + if (_setjmp(cc->jmp) == 0) { > > + ucontext_t tmp; > > + swapcontext(&tmp, &cc->last); > > + } > > > > - cc->entry(cc); > > + cc->entry(cc); > > } > > > > void cc_init(struct continuation *cc) > > { > > - volatile union cc_arg arg; > > - arg.p = cc; > > - if (getcontext(&cc->uc) == -1) > > - g_error("getcontext() failed: %s", g_strerror(errno)); > > - cc->uc.uc_link = &cc->last; > > - cc->uc.uc_stack.ss_sp = cc->stack; > > - cc->uc.uc_stack.ss_size = cc->stack_size; > > - cc->uc.uc_stack.ss_flags = 0; > > + volatile union cc_arg arg; > > + arg.p = cc; > > + if (getcontext(&cc->uc) == -1) > > + g_error("getcontext() failed: %s", g_strerror(errno)); > > + cc->uc.uc_link = &cc->last; > > + cc->uc.uc_stack.ss_sp = cc->stack; > > + cc->uc.uc_stack.ss_size = cc->stack_size; > > + cc->uc.uc_stack.ss_flags = 0; > > > > - makecontext(&cc->uc, (void *)continuation_trampoline, 2, arg.i[0], > > arg.i[1]); > > - swapcontext(&cc->last, &cc->uc); > > + makecontext(&cc->uc, (void *)continuation_trampoline, 2, > > arg.i[0], arg.i[1]); > > + swapcontext(&cc->last, &cc->uc); > > } > > > > int cc_release(struct continuation *cc) > > { > > - if (cc->release) > > - return cc->release(cc); > > + if (cc->release) > > + return cc->release(cc); > > > > - return 0; > > + return 0; > > } > > > > int cc_swap(struct continuation *from, struct continuation *to) > > { > > - to->exited = 0; > > - if (getcontext(&to->last) == -1) > > - return -1; > > - else if (to->exited == 0) > > - to->exited = 1; // so when coroutine finishes > > + to->exited = 0; > > + if (getcontext(&to->last) == -1) > > + return -1; > > + else if (to->exited == 0) > > + to->exited = 1; // so when coroutine finishes > > else if (to->exited == 1) > > return 1; // it ends up here > > > > - if (_setjmp(from->jmp) == 0) > > - _longjmp(to->jmp, 1); > > + if (_setjmp(from->jmp) == 0) > > + _longjmp(to->jmp, 1); > > > > - return 0; > > + return 0; > > } > > /* > > * Local variables: > > diff --git a/gtk/continuation.h b/gtk/continuation.h > > index 675a257..31d5bff 100644 > > --- a/gtk/continuation.h > > +++ b/gtk/continuation.h > > @@ -27,16 +27,16 @@ > > > > struct continuation > > { > > - char *stack; > > - size_t stack_size; > > - void (*entry)(struct continuation *cc); > > - int (*release)(struct continuation *cc); > > + char *stack; > > + size_t stack_size; > > + void (*entry)(struct continuation *cc); > > + int (*release)(struct continuation *cc); > > > > - /* private */ > > - ucontext_t uc; > > - ucontext_t last; > > - int exited; > > - jmp_buf jmp; > > + /* private */ > > + ucontext_t uc; > > + ucontext_t last; > > + int exited; > > + jmp_buf jmp; > > }; > > > > void cc_init(struct continuation *cc); > > diff --git a/gtk/controller/namedpipe.c b/gtk/controller/namedpipe.c > > index 5312218..8bdc6da 100644 > > --- a/gtk/controller/namedpipe.c > > +++ b/gtk/controller/namedpipe.c > > @@ -28,8 +28,8 @@ static gboolean spice_named_pipe_initable_init > > (GInitable *initable, > > GError > > **error); > > > > G_DEFINE_TYPE_WITH_CODE (SpiceNamedPipe, spice_named_pipe, G_TYPE_OBJECT, > > - G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, > > - > > spice_named_pipe_initable_iface_init)); > > + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, > > + > > spice_named_pipe_initable_iface_init)); > > > > enum > > { > > @@ -164,7 +164,7 @@ spice_named_pipe_class_init (SpiceNamedPipeClass > > *klass) > > gobject_class->constructed = spice_named_pipe_constructed; > > > > g_object_class_install_property (gobject_class, PROP_NAME, > > - g_param_spec_string ("name", > > + g_param_spec_string ("name", > > "Pipe Name", > > "The NamedPipe > > name", > > NULL, > > @@ -212,7 +212,7 @@ spice_named_pipe_initable_init (GInitable *initable, > > if (np->priv->construct_error) > > { > > if (error) > > - *error = g_error_copy (np->priv->construct_error); > > + *error = g_error_copy (np->priv->construct_error); > > return FALSE; > > } > > > > @@ -259,9 +259,9 @@ spice_named_pipe_close (SpiceNamedPipe *np, > > gchar *emsg = g_win32_error_message (errsv); > > > > g_set_error (error, G_IO_ERROR, > > - g_io_error_from_win32_error (errsv), > > - "Error closing handle: %s", > > - emsg); > > + g_io_error_from_win32_error (errsv), > > + "Error closing handle: %s", > > + emsg); > > g_free (emsg); > > return FALSE; > > } > > diff --git a/gtk/controller/namedpipeconnection.c > > b/gtk/controller/namedpipeconnection.c > > index 3173b61..385038f 100644 > > --- a/gtk/controller/namedpipeconnection.c > > +++ b/gtk/controller/namedpipeconnection.c > > @@ -200,9 +200,9 @@ spice_named_pipe_connection_close_async (GIOStream > > *stream, > > } > > > > res = g_simple_async_result_new (G_OBJECT (stream), > > - callback, > > - user_data, > > - > > spice_named_pipe_connection_close_async); > > + callback, > > + user_data, > > + > > spice_named_pipe_connection_close_async); > > g_simple_async_result_complete_in_idle (res); > > g_object_unref (res); > > } > > diff --git a/gtk/coroutine.h b/gtk/coroutine.h > > index 78dc467..29be733 100644 > > --- a/gtk/coroutine.h > > +++ b/gtk/coroutine.h > > @@ -33,25 +33,25 @@ > > > > struct coroutine > > { > > - size_t stack_size; > > - void *(*entry)(void *); > > - int (*release)(struct coroutine *); > > + size_t stack_size; > > + void *(*entry)(void *); > > + int (*release)(struct coroutine *); > > > > - /* read-only */ > > - int exited; > > + /* read-only */ > > + int exited; > > > > - /* private */ > > - struct coroutine *caller; > > - void *data; > > + /* private */ > > + struct coroutine *caller; > > + void *data; > > > > #if WITH_UCONTEXT > > - struct continuation cc; > > + struct continuation cc; > > #elif WITH_WINFIBER > > LPVOID fiber; > > int ret; > > #else > > - GThread *thread; > > - gboolean runnable; > > + GThread *thread; > > + gboolean runnable; > > #endif > > }; > > > > @@ -70,7 +70,7 @@ void *coroutine_yield(void *arg); > > gboolean coroutine_is_main(struct coroutine *co); > > > > static inline gboolean coroutine_self_is_main(void) { > > - return coroutine_self() == NULL || > > coroutine_is_main(coroutine_self()); > > + return coroutine_self() == NULL || > > coroutine_is_main(coroutine_self()); > > } > > > > #endif > > diff --git a/gtk/coroutine_gthread.c b/gtk/coroutine_gthread.c > > index b0098fa..3585d42 100644 > > --- a/gtk/coroutine_gthread.c > > +++ b/gtk/coroutine_gthread.c > > @@ -37,131 +37,131 @@ static struct coroutine leader; > > > > static void coroutine_system_init(void) > > { > > - if (!g_thread_supported()) { > > - CO_DEBUG("INIT"); > > - g_thread_init(NULL); > > - } > > + if (!g_thread_supported()) { > > + CO_DEBUG("INIT"); > > + g_thread_init(NULL); > > + } > > > > > > - run_cond = g_cond_new(); > > - run_lock = g_mutex_new(); > > - CO_DEBUG("LOCK"); > > - g_mutex_lock(run_lock); > > + run_cond = g_cond_new(); > > + run_lock = g_mutex_new(); > > + CO_DEBUG("LOCK"); > > + g_mutex_lock(run_lock); > > > > - /* The thread that creates the first coroutine is the system > > coroutine > > - * so let's fill out a structure for it */ > > - leader.entry = NULL; > > - leader.release = NULL; > > - leader.stack_size = 0; > > - leader.exited = 0; > > - leader.thread = g_thread_self(); > > - leader.runnable = TRUE; /* we're the one running right now */ > > - leader.caller = NULL; > > - leader.data = NULL; > > + /* The thread that creates the first coroutine is the system > > coroutine > > + * so let's fill out a structure for it */ > > + leader.entry = NULL; > > + leader.release = NULL; > > + leader.stack_size = 0; > > + leader.exited = 0; > > + leader.thread = g_thread_self(); > > + leader.runnable = TRUE; /* we're the one running right now */ > > + leader.caller = NULL; > > + leader.data = NULL; > > > > - current = &leader; > > + current = &leader; > > } > > > > static gpointer coroutine_thread(gpointer opaque) > > { > > - struct coroutine *co = opaque; > > - CO_DEBUG("LOCK"); > > - g_mutex_lock(run_lock); > > - while (!co->runnable) { > > - CO_DEBUG("WAIT"); > > - g_cond_wait(run_cond, run_lock); > > - } > > + struct coroutine *co = opaque; > > + CO_DEBUG("LOCK"); > > + g_mutex_lock(run_lock); > > + while (!co->runnable) { > > + CO_DEBUG("WAIT"); > > + g_cond_wait(run_cond, run_lock); > > + } > > > > - CO_DEBUG("RUNNABLE"); > > - current = co; > > - co->caller->data = co->entry(co->data); > > - co->exited = 1; > > + CO_DEBUG("RUNNABLE"); > > + current = co; > > + co->caller->data = co->entry(co->data); > > + co->exited = 1; > > > > - co->caller->runnable = TRUE; > > - CO_DEBUG("BROADCAST"); > > - g_cond_broadcast(run_cond); > > - CO_DEBUG("UNLOCK"); > > - g_mutex_unlock(run_lock); > > + co->caller->runnable = TRUE; > > + CO_DEBUG("BROADCAST"); > > + g_cond_broadcast(run_cond); > > + CO_DEBUG("UNLOCK"); > > + g_mutex_unlock(run_lock); > > > > - return NULL; > > + return NULL; > > } > > > > void coroutine_init(struct coroutine *co) > > { > > - GError *err = NULL; > > + GError *err = NULL; > > > > - if (run_cond == NULL) > > - coroutine_system_init(); > > + if (run_cond == NULL) > > + coroutine_system_init(); > > > > - CO_DEBUG("NEW"); > > - co->thread = g_thread_create_full(coroutine_thread, co, > > co->stack_size, > > - FALSE, TRUE, > > - G_THREAD_PRIORITY_NORMAL, > > - &err); > > - if (err != NULL) > > - g_error("g_thread_create_full() failed: %s", err->message); > > + CO_DEBUG("NEW"); > > + co->thread = g_thread_create_full(coroutine_thread, co, > > co->stack_size, > > + FALSE, TRUE, > > + G_THREAD_PRIORITY_NORMAL, > > + &err); > > + if (err != NULL) > > + g_error("g_thread_create_full() failed: %s", > > err->message); > > > > - co->exited = 0; > > - co->runnable = FALSE; > > - co->caller = NULL; > > + co->exited = 0; > > + co->runnable = FALSE; > > + co->caller = NULL; > > } > > > > int coroutine_release(struct coroutine *co G_GNUC_UNUSED) > > { > > - return 0; > > + return 0; > > } > > > > void *coroutine_swap(struct coroutine *from, struct coroutine *to, void > > *arg) > > { > > - from->runnable = FALSE; > > - to->runnable = TRUE; > > - to->data = arg; > > - to->caller = from; > > - CO_DEBUG("BROADCAST"); > > - g_cond_broadcast(run_cond); > > - CO_DEBUG("UNLOCK"); > > - g_mutex_unlock(run_lock); > > - CO_DEBUG("LOCK"); > > - g_mutex_lock(run_lock); > > - while (!from->runnable) { > > - CO_DEBUG("WAIT"); > > - g_cond_wait(run_cond, run_lock); > > - } > > - current = from; > > - to->caller = NULL; > > + from->runnable = FALSE; > > + to->runnable = TRUE; > > + to->data = arg; > > + to->caller = from; > > + CO_DEBUG("BROADCAST"); > > + g_cond_broadcast(run_cond); > > + CO_DEBUG("UNLOCK"); > > + g_mutex_unlock(run_lock); > > + CO_DEBUG("LOCK"); > > + g_mutex_lock(run_lock); > > + while (!from->runnable) { > > + CO_DEBUG("WAIT"); > > + g_cond_wait(run_cond, run_lock); > > + } > > + current = from; > > + to->caller = NULL; > > > > - CO_DEBUG("SWAPPED"); > > - return from->data; > > + CO_DEBUG("SWAPPED"); > > + return from->data; > > } > > > > struct coroutine *coroutine_self(void) > > { > > - if (run_cond == NULL) > > - coroutine_system_init(); > > + if (run_cond == NULL) > > + coroutine_system_init(); > > > > - return current; > > + return current; > > } > > > > void *coroutine_yieldto(struct coroutine *to, void *arg) > > { > > - g_return_val_if_fail(!to->caller, NULL); > > - g_return_val_if_fail(!to->exited, NULL); > > + g_return_val_if_fail(!to->caller, NULL); > > + g_return_val_if_fail(!to->exited, NULL); > > > > - CO_DEBUG("SWAP"); > > - return coroutine_swap(coroutine_self(), to, arg); > > + CO_DEBUG("SWAP"); > > + return coroutine_swap(coroutine_self(), to, arg); > > } > > > > void *coroutine_yield(void *arg) > > { > > - struct coroutine *to = coroutine_self()->caller; > > - if (!to) { > > - fprintf(stderr, "Co-routine is yielding to no one\n"); > > - abort(); > > - } > > + struct coroutine *to = coroutine_self()->caller; > > + if (!to) { > > + fprintf(stderr, "Co-routine is yielding to no one\n"); > > + abort(); > > + } > > > > - CO_DEBUG("SWAP"); > > - coroutine_self()->caller = NULL; > > - return coroutine_swap(coroutine_self(), to, arg); > > + CO_DEBUG("SWAP"); > > + coroutine_self()->caller = NULL; > > + return coroutine_swap(coroutine_self(), to, arg); > > } > > > > gboolean coroutine_is_main(struct coroutine *co) > > diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c > > index d709a33..4ddb717 100644 > > --- a/gtk/coroutine_ucontext.c > > +++ b/gtk/coroutine_ucontext.c > > @@ -37,51 +37,51 @@ > > > > int coroutine_release(struct coroutine *co) > > { > > - return cc_release(&co->cc); > > + return cc_release(&co->cc); > > } > > > > static int _coroutine_release(struct continuation *cc) > > { > > - struct coroutine *co = container_of(cc, struct coroutine, cc); > > + struct coroutine *co = container_of(cc, struct coroutine, cc); > > > > - if (co->release) { > > - int ret = co->release(co); > > - if (ret < 0) > > - return ret; > > - } > > + if (co->release) { > > + int ret = co->release(co); > > + if (ret < 0) > > + return ret; > > + } > > > > - munmap(co->cc.stack, co->cc.stack_size); > > + munmap(co->cc.stack, co->cc.stack_size); > > > > - co->caller = NULL; > > + co->caller = NULL; > > > > - return 0; > > + return 0; > > } > > > > static void coroutine_trampoline(struct continuation *cc) > > { > > - struct coroutine *co = container_of(cc, struct coroutine, cc); > > - co->data = co->entry(co->data); > > + struct coroutine *co = container_of(cc, struct coroutine, cc); > > + co->data = co->entry(co->data); > > } > > > > void coroutine_init(struct coroutine *co) > > { > > - if (co->stack_size == 0) > > - co->stack_size = 16 << 20; > > + if (co->stack_size == 0) > > + co->stack_size = 16 << 20; > > > > - co->cc.stack_size = co->stack_size; > > - co->cc.stack = mmap(0, co->stack_size, > > - PROT_READ | PROT_WRITE, > > - MAP_PRIVATE | MAP_ANONYMOUS, > > - -1, 0); > > - if (co->cc.stack == MAP_FAILED) > > - g_error("mmap(%" G_GSIZE_FORMAT ") failed: %s", > > - co->stack_size, g_strerror(errno)); > > + co->cc.stack_size = co->stack_size; > > + co->cc.stack = mmap(0, co->stack_size, > > + PROT_READ | PROT_WRITE, > > + MAP_PRIVATE | MAP_ANONYMOUS, > > + -1, 0); > > + if (co->cc.stack == MAP_FAILED) > > + g_error("mmap(%" G_GSIZE_FORMAT ") failed: %s", > > + co->stack_size, g_strerror(errno)); > > > > - co->cc.entry = coroutine_trampoline; > > - co->cc.release = _coroutine_release; > > - co->exited = 0; > > + co->cc.entry = coroutine_trampoline; > > + co->cc.release = _coroutine_release; > > + co->exited = 0; > > > > - cc_init(&co->cc); > > + cc_init(&co->cc); > > } > > > > #if 0 > > @@ -94,47 +94,47 @@ static struct coroutine *current; > > > > struct coroutine *coroutine_self(void) > > { > > - if (current == NULL) > > - current = &leader; > > - return current; > > + if (current == NULL) > > + current = &leader; > > + return current; > > } > > > > void *coroutine_swap(struct coroutine *from, struct coroutine *to, void > > *arg) > > { > > - int ret; > > - to->data = arg; > > - current = to; > > - ret = cc_swap(&from->cc, &to->cc); > > - if (ret == 0) > > - return from->data; > > - else if (ret == 1) { > > - coroutine_release(to); > > - current = from; > > - to->exited = 1; > > - return to->data; > > - } > > + int ret; > > + to->data = arg; > > + current = to; > > + ret = cc_swap(&from->cc, &to->cc); > > + if (ret == 0) > > + return from->data; > > + else if (ret == 1) { > > + coroutine_release(to); > > + current = from; > > + to->exited = 1; > > + return to->data; > > + } > > > > - return NULL; > > + return NULL; > > } > > > > void *coroutine_yieldto(struct coroutine *to, void *arg) > > { > > - g_return_val_if_fail(!to->caller, NULL); > > - g_return_val_if_fail(!to->exited, NULL); > > + g_return_val_if_fail(!to->caller, NULL); > > + g_return_val_if_fail(!to->exited, NULL); > > > > - to->caller = coroutine_self(); > > - return coroutine_swap(coroutine_self(), to, arg); > > + to->caller = coroutine_self(); > > + return coroutine_swap(coroutine_self(), to, arg); > > } > > > > void *coroutine_yield(void *arg) > > { > > - struct coroutine *to = coroutine_self()->caller; > > - if (!to) { > > - fprintf(stderr, "Co-routine is yielding to no one\n"); > > - abort(); > > - } > > - coroutine_self()->caller = NULL; > > - return coroutine_swap(coroutine_self(), to, arg); > > + struct coroutine *to = coroutine_self()->caller; > > + if (!to) { > > + fprintf(stderr, "Co-routine is yielding to no one\n"); > > + abort(); > > + } > > + coroutine_self()->caller = NULL; > > + return coroutine_swap(coroutine_self(), to, arg); > > } > > > > gboolean coroutine_is_main(struct coroutine *co) > > diff --git a/gtk/coroutine_winfibers.c b/gtk/coroutine_winfibers.c > > index a56d33d..a448f45 100644 > > --- a/gtk/coroutine_winfibers.c > > +++ b/gtk/coroutine_winfibers.c > > @@ -30,87 +30,87 @@ static struct coroutine *caller = NULL; > > > > int coroutine_release(struct coroutine *co) > > { > > - DeleteFiber(co->fiber); > > - return 0; > > + DeleteFiber(co->fiber); > > + return 0; > > } > > > > static void WINAPI coroutine_trampoline(LPVOID lpParameter) > > { > > - struct coroutine *co = (struct coroutine *)lpParameter; > > + struct coroutine *co = (struct coroutine *)lpParameter; > > > > - co->data = co->entry(co->data); > > + co->data = co->entry(co->data); > > > > - if (co->release) > > - co->ret = co->release(co); > > - else > > - co->ret = 0; > > + if (co->release) > > + co->ret = co->release(co); > > + else > > + co->ret = 0; > > > > - co->caller = NULL; > > + co->caller = NULL; > > > > - // and switch back to caller > > - co->ret = 1; > > - SwitchToFiber(caller->fiber); > > + // and switch back to caller > > + co->ret = 1; > > + SwitchToFiber(caller->fiber); > > } > > > > void coroutine_init(struct coroutine *co) > > { > > - if (leader.fiber == NULL) { > > - leader.fiber = ConvertThreadToFiber(&leader); > > - if (leader.fiber == NULL) > > - g_error("ConvertThreadToFiber() failed"); > > - } > > + if (leader.fiber == NULL) { > > + leader.fiber = ConvertThreadToFiber(&leader); > > + if (leader.fiber == NULL) > > + g_error("ConvertThreadToFiber() failed"); > > + } > > > > - co->exited = 0; > > - co->fiber = CreateFiber(0, &coroutine_trampoline, co); > > - if (co->fiber == NULL) > > - g_error("CreateFiber() failed"); > > + co->exited = 0; > > + co->fiber = CreateFiber(0, &coroutine_trampoline, co); > > + if (co->fiber == NULL) > > + g_error("CreateFiber() failed"); > > > > - co->ret = 0; > > + co->ret = 0; > > } > > > > struct coroutine *coroutine_self(void) > > { > > - if (current == NULL) > > - current = &leader; > > - return current; > > + if (current == NULL) > > + current = &leader; > > + return current; > > } > > > > void *coroutine_swap(struct coroutine *from, struct coroutine *to, void > > *arg) > > { > > - to->data = arg; > > - current = to; > > - caller = from; > > - SwitchToFiber(to->fiber); > > - if (to->ret == 0) > > - return from->data; > > - else if (to->ret == 1) { > > - coroutine_release(to); > > - current = &leader; > > - to->exited = 1; > > - return to->data; > > - } > > + to->data = arg; > > + current = to; > > + caller = from; > > + SwitchToFiber(to->fiber); > > + if (to->ret == 0) > > + return from->data; > > + else if (to->ret == 1) { > > + coroutine_release(to); > > + current = &leader; > > + to->exited = 1; > > + return to->data; > > + } > > > > - return NULL; > > + return NULL; > > } > > > > void *coroutine_yieldto(struct coroutine *to, void *arg) > > { > > - g_return_val_if_fail(!to->caller, NULL); > > - g_return_val_if_fail(!to->exited, NULL); > > + g_return_val_if_fail(!to->caller, NULL); > > + g_return_val_if_fail(!to->exited, NULL); > > > > - to->caller = coroutine_self(); > > - return coroutine_swap(coroutine_self(), to, arg); > > + to->caller = coroutine_self(); > > + return coroutine_swap(coroutine_self(), to, arg); > > } > > > > void *coroutine_yield(void *arg) > > { > > - struct coroutine *to = coroutine_self()->caller; > > - if (!to) { > > - fprintf(stderr, "Co-routine is yielding to no one\n"); > > - abort(); > > - } > > - coroutine_self()->caller = NULL; > > - return coroutine_swap(coroutine_self(), to, arg); > > + struct coroutine *to = coroutine_self()->caller; > > + if (!to) { > > + fprintf(stderr, "Co-routine is yielding to no one\n"); > > + abort(); > > + } > > + coroutine_self()->caller = NULL; > > + return coroutine_swap(coroutine_self(), to, arg); > > } > > > > gboolean coroutine_is_main(struct coroutine *co) > > diff --git a/gtk/gio-coroutine.c b/gtk/gio-coroutine.c > > index c903bd2..e5812df 100644 > > --- a/gtk/gio-coroutine.c > > +++ b/gtk/gio-coroutine.c > > @@ -37,8 +37,8 @@ GCoroutine* g_coroutine_self(void) > > > > /* Main loop helper functions */ > > static gboolean g_io_wait_helper(GSocket *sock G_GNUC_UNUSED, > > - GIOCondition cond, > > - gpointer data) > > + GIOCondition cond, > > + gpointer data) > > { > > struct coroutine *to = data; > > coroutine_yieldto(to, &cond); > > @@ -96,7 +96,7 @@ void g_coroutine_wakeup(GCoroutine *coroutine) > > * true if the condition we're checking is ready for dispatch > > */ > > static gboolean g_condition_wait_prepare(GSource *src, > > - int *timeout) { > > + int *timeout) { > > GConditionWaitSource *vsrc = (GConditionWaitSource *)src; > > *timeout = -1; > > return vsrc->func(vsrc->data); > > @@ -113,8 +113,8 @@ static gboolean g_condition_wait_check(GSource *src) > > } > > > > static gboolean g_condition_wait_dispatch(GSource *src G_GNUC_UNUSED, > > - GSourceFunc cb, > > - gpointer data) { > > + GSourceFunc cb, > > + gpointer data) { > > return cb(data); > > } > > > > diff --git a/gtk/glib-compat.c b/gtk/glib-compat.c > > index 9d1165e..32da168 100644 > > --- a/gtk/glib-compat.c > > +++ b/gtk/glib-compat.c > > @@ -88,7 +88,7 @@ g_simple_async_result_take_error (GSimpleAsyncResult > > *simple, > > **/ > > G_GNUC_INTERNAL void > > g_slist_free_full (GSList *list, > > - GDestroyNotify free_func) > > + GDestroyNotify free_func) > > { > > g_slist_foreach (list, (GFunc) free_func, NULL); > > g_slist_free (list); > > diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h > > index 45d961e..17cabaf 100644 > > --- a/gtk/glib-compat.h > > +++ b/gtk/glib-compat.h > > @@ -75,9 +75,9 @@ GType spice_error_get_type (void) G_GNUC_CONST; > > #define G_PARAM_DEPRECATED (1 << 31) > > > > void g_key_file_set_uint64 (GKeyFile > > *key_file, > > - const gchar > > *group_name, > > - const gchar *key, > > - guint64 value); > > + const gchar > > *group_name, > > + const gchar *key, > > + guint64 value); > > #endif /* glib 2.26 */ > > > > #if !GLIB_CHECK_VERSION(2,28,0) > > diff --git a/gtk/spice-audio.h b/gtk/spice-audio.h > > index ebc4946..af2bca5 100644 > > --- a/gtk/spice-audio.h > > +++ b/gtk/spice-audio.h > > @@ -26,10 +26,10 @@ G_BEGIN_DECLS > > > > #define SPICE_TYPE_AUDIO spice_audio_get_type() > > > > -#define SPICE_AUDIO(obj) \ > > +#define SPICE_AUDIO(obj) \ > > (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_TYPE_AUDIO, SpiceAudio)) > > > > -#define SPICE_AUDIO_CLASS(klass) \ > > +#define SPICE_AUDIO_CLASS(klass) \ > > (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_TYPE_AUDIO, SpiceAudioClass)) > > > > #define SPICE_IS_AUDIO(obj) \ > > @@ -38,7 +38,7 @@ G_BEGIN_DECLS > > #define SPICE_IS_AUDIO_CLASS(klass) \ > > (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_TYPE_AUDIO)) > > > > -#define SPICE_AUDIO_GET_CLASS(obj) \ > > +#define SPICE_AUDIO_GET_CLASS(obj) \ > > (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_TYPE_AUDIO, SpiceAudioClass)) > > > > typedef struct _SpiceAudio SpiceAudio; > > diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c > > index cd031e4..ae281c4 100644 > > --- a/gtk/spice-channel.c > > +++ b/gtk/spice-channel.c > > @@ -1241,7 +1241,7 @@ static gchar *addr_to_string(GSocketAddress *addr) > > > > static gboolean > > spice_channel_gather_sasl_credentials(SpiceChannel *channel, > > - sasl_interact_t *interact) > > + sasl_interact_t *interact) > > { > > SpiceChannelPrivate *c; > > int ninteract; > > diff --git a/gtk/spice-grabsequence.c b/gtk/spice-grabsequence.c > > index 39adfb0..2ebc064 100644 > > --- a/gtk/spice-grabsequence.c > > +++ b/gtk/spice-grabsequence.c > > @@ -27,19 +27,19 @@ > > > > GType spice_grab_sequence_get_type(void) > > { > > - static GType grab_sequence_type = 0; > > - static volatile gsize grab_sequence_type_volatile; > > + static GType grab_sequence_type = 0; > > + static volatile gsize grab_sequence_type_volatile; > > > > - if (g_once_init_enter(&grab_sequence_type_volatile)) { > > - grab_sequence_type = g_boxed_type_register_static > > - ("SpiceGrabSequence", > > - (GBoxedCopyFunc)spice_grab_sequence_copy, > > - (GBoxedFreeFunc)spice_grab_sequence_free); > > - g_once_init_leave(&grab_sequence_type_volatile, > > - grab_sequence_type); > > - } > > + if (g_once_init_enter(&grab_sequence_type_volatile)) { > > + grab_sequence_type = g_boxed_type_register_static > > + ("SpiceGrabSequence", > > + (GBoxedCopyFunc)spice_grab_sequence_copy, > > + (GBoxedFreeFunc)spice_grab_sequence_free); > > + g_once_init_leave(&grab_sequence_type_volatile, > > + grab_sequence_type); > > + } > > > > - return grab_sequence_type; > > + return grab_sequence_type; > > } > > > > > > @@ -54,14 +54,14 @@ GType spice_grab_sequence_get_type(void) > > */ > > SpiceGrabSequence *spice_grab_sequence_new(guint nkeysyms, guint *keysyms) > > { > > - SpiceGrabSequence *sequence; > > + SpiceGrabSequence *sequence; > > > > - sequence = g_slice_new0(SpiceGrabSequence); > > - sequence->nkeysyms = nkeysyms; > > - sequence->keysyms = g_new0(guint, nkeysyms); > > - memcpy(sequence->keysyms, keysyms, sizeof(guint)*nkeysyms); > > + sequence = g_slice_new0(SpiceGrabSequence); > > + sequence->nkeysyms = nkeysyms; > > + sequence->keysyms = g_new0(guint, nkeysyms); > > + memcpy(sequence->keysyms, keysyms, sizeof(guint)*nkeysyms); > > > > - return sequence; > > + return sequence; > > } > > > > > > @@ -73,29 +73,29 @@ SpiceGrabSequence *spice_grab_sequence_new(guint > > nkeysyms, guint *keysyms) > > **/ > > SpiceGrabSequence *spice_grab_sequence_new_from_string(const gchar *str) > > { > > - gchar **keysymstr; > > - int i; > > - SpiceGrabSequence *sequence; > > + gchar **keysymstr; > > + int i; > > + SpiceGrabSequence *sequence; > > > > - sequence = g_slice_new0(SpiceGrabSequence); > > + sequence = g_slice_new0(SpiceGrabSequence); > > > > - keysymstr = g_strsplit(str, "+", 5); > > + keysymstr = g_strsplit(str, "+", 5); > > > > - sequence->nkeysyms = 0; > > - while (keysymstr[sequence->nkeysyms]) > > - sequence->nkeysyms++; > > + sequence->nkeysyms = 0; > > + while (keysymstr[sequence->nkeysyms]) > > + sequence->nkeysyms++; > > > > - sequence->keysyms = g_new0(guint, sequence->nkeysyms); > > - for (i = 0 ; i < sequence->nkeysyms ; i++) { > > - sequence->keysyms[i] = > > - (guint)gdk_keyval_from_name(keysymstr[i]); > > + sequence->keysyms = g_new0(guint, sequence->nkeysyms); > > + for (i = 0 ; i < sequence->nkeysyms ; i++) { > > + sequence->keysyms[i] = > > + (guint)gdk_keyval_from_name(keysymstr[i]); > > if (sequence->keysyms[i] == 0) { > > g_critical("Invalid key: %s", keysymstr[i]); > > } > > } > > - g_strfreev(keysymstr); > > + g_strfreev(keysymstr); > > > > - return sequence; > > + return sequence; > > > > } > > > > @@ -108,14 +108,14 @@ SpiceGrabSequence > > *spice_grab_sequence_new_from_string(const gchar *str) > > **/ > > SpiceGrabSequence *spice_grab_sequence_copy(SpiceGrabSequence > > *srcSequence) > > { > > - SpiceGrabSequence *sequence; > > + SpiceGrabSequence *sequence; > > > > - sequence = g_slice_dup(SpiceGrabSequence, srcSequence); > > - sequence->keysyms = g_new0(guint, srcSequence->nkeysyms); > > - memcpy(sequence->keysyms, srcSequence->keysyms, > > - sizeof(guint) * sequence->nkeysyms); > > + sequence = g_slice_dup(SpiceGrabSequence, srcSequence); > > + sequence->keysyms = g_new0(guint, srcSequence->nkeysyms); > > + memcpy(sequence->keysyms, srcSequence->keysyms, > > + sizeof(guint) * sequence->nkeysyms); > > > > - return sequence; > > + return sequence; > > } > > > > > > @@ -127,8 +127,8 @@ SpiceGrabSequence > > *spice_grab_sequence_copy(SpiceGrabSequence *srcSequence) > > **/ > > void spice_grab_sequence_free(SpiceGrabSequence *sequence) > > { > > - g_free(sequence->keysyms); > > - g_slice_free(SpiceGrabSequence, sequence); > > + g_free(sequence->keysyms); > > + g_slice_free(SpiceGrabSequence, sequence); > > } > > > > > > @@ -140,16 +140,16 @@ void spice_grab_sequence_free(SpiceGrabSequence > > *sequence) > > **/ > > gchar *spice_grab_sequence_as_string(SpiceGrabSequence *sequence) > > { > > - GString *str = g_string_new(""); > > - int i; > > + GString *str = g_string_new(""); > > + int i; > > > > - for (i = 0 ; i < sequence->nkeysyms ; i++) { > > - if (i > 0) > > - g_string_append_c(str, '+'); > > - g_string_append(str, > > gdk_keyval_name(sequence->keysyms[i])); > > - } > > + for (i = 0 ; i < sequence->nkeysyms ; i++) { > > + if (i > 0) > > + g_string_append_c(str, '+'); > > + g_string_append(str, > > gdk_keyval_name(sequence->keysyms[i])); > > + } > > > > - return g_string_free(str, FALSE); > > + return g_string_free(str, FALSE); > > > > } > > > > diff --git a/gtk/spice-grabsequence.h b/gtk/spice-grabsequence.h > > index fe58fc1..4910856 100644 > > --- a/gtk/spice-grabsequence.h > > +++ b/gtk/spice-grabsequence.h > > @@ -33,10 +33,10 @@ typedef struct _SpiceGrabSequence SpiceGrabSequence; > > > > struct _SpiceGrabSequence { > > /*< private >*/ > > - guint nkeysyms; > > - guint *keysyms; > > + guint nkeysyms; > > + guint *keysyms; > > > > - /* Do not add fields to this struct */ > > + /* Do not add fields to this struct */ > > }; > > > > GType spice_grab_sequence_get_type(void); > > diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c > > index 10bd762..3ef382c 100644 > > --- a/gtk/spice-gtk-session.c > > +++ b/gtk/spice-gtk-session.c > > @@ -304,7 +304,7 @@ static void spice_gtk_session_get_property(GObject > > *gobject, > > switch (prop_id) { > > case PROP_SESSION: > > g_value_set_object(value, s->session); > > - break; > > + break; > > case PROP_AUTO_CLIPBOARD: > > g_value_set_boolean(value, s->auto_clipboard_enable); > > break; > > @@ -312,8 +312,8 @@ static void spice_gtk_session_get_property(GObject > > *gobject, > > g_value_set_boolean(value, s->auto_usbredir_enable); > > break; > > default: > > - G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > > - break; > > + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > > + break; > > } > > } > > > > diff --git a/gtk/spice-session.c b/gtk/spice-session.c > > index 0663380..ed08e1a 100644 > > --- a/gtk/spice-session.c > > +++ b/gtk/spice-session.c > > @@ -420,44 +420,44 @@ static void spice_session_get_property(GObject > > *gobject, > > switch (prop_id) { > > case PROP_HOST: > > g_value_set_string(value, s->host); > > - break; > > + break; > > case PROP_PORT: > > g_value_set_string(value, s->port); > > - break; > > + break; > > case PROP_TLS_PORT: > > g_value_set_string(value, s->tls_port); > > - break; > > + break; > > case PROP_USERNAME: > > g_value_set_string(value, s->username); > > - break; > > + break; > > case PROP_PASSWORD: > > g_value_set_string(value, s->password); > > - break; > > + break; > > case PROP_CA_FILE: > > g_value_set_string(value, s->ca_file); > > - break; > > + break; > > case PROP_CIPHERS: > > g_value_set_string(value, s->ciphers); > > - break; > > + break; > > case PROP_PROTOCOL: > > g_value_set_int(value, s->protocol); > > - break; > > + break; > > case PROP_URI: > > len = spice_uri_create(session, buf, sizeof(buf)); > > g_value_set_string(value, len ? buf : NULL); > > break; > > case PROP_CLIENT_SOCKETS: > > g_value_set_boolean(value, s->client_provided_sockets); > > - break; > > + break; > > case PROP_PUBKEY: > > g_value_set_boxed(value, s->pubkey); > > - break; > > + break; > > case PROP_CA: > > g_value_set_boxed(value, s->ca); > > - break; > > + break; > > case PROP_CERT_SUBJECT: > > g_value_set_string(value, s->cert_subject); > > - break; > > + break; > > case PROP_VERIFY: > > g_value_set_flags(value, s->verify); > > break; > > @@ -502,19 +502,19 @@ static void spice_session_get_property(GObject > > *gobject, > > break; > > case PROP_NAME: > > g_value_set_string(value, s->name); > > - break; > > + break; > > case PROP_UUID: > > g_value_set_pointer(value, s->uuid); > > - break; > > + break; > > case PROP_PROXY: > > g_value_take_string(value, spice_uri_to_string(s->proxy)); > > - break; > > + break; > > case PROP_SHARED_DIR: > > g_value_set_string(value, spice_session_get_shared_dir(session)); > > break; > > default: > > - G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > > - break; > > + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); > > + break; > > } > > } > > > > @@ -575,7 +575,7 @@ static void spice_session_set_property(GObject > > *gobject, > > s->verify |= SPICE_SESSION_VERIFY_PUBKEY; > > else > > s->verify &= ~SPICE_SESSION_VERIFY_PUBKEY; > > - break; > > + break; > > case PROP_CERT_SUBJECT: > > g_free(s->cert_subject); > > s->cert_subject = g_value_dup_string(value); > > diff --git a/gtk/spice-util.c b/gtk/spice-util.c > > index bec237b..ab29d32 100644 > > --- a/gtk/spice-util.c > > +++ b/gtk/spice-util.c > > @@ -47,7 +47,7 @@ static void spice_util_enable_debug_messages(void) > > if (!doms) { > > g_setenv("G_MESSAGES_DEBUG", G_LOG_DOMAIN, 1); > > } else if (g_str_equal(doms, "all")) { > > - return; > > + return; > > } else if (!strstr(doms, G_LOG_DOMAIN)) { > > gchar *newdoms = g_strdup_printf("%s %s", doms, G_LOG_DOMAIN); > > g_setenv("G_MESSAGES_DEBUG", newdoms, 1); > > diff --git a/gtk/spice-widget.h b/gtk/spice-widget.h > > index d239ed2..ac85dac 100644 > > --- a/gtk/spice-widget.h > > +++ b/gtk/spice-widget.h > > @@ -63,12 +63,12 @@ struct _SpiceDisplayClass { > > > > typedef enum > > { > > - SPICE_DISPLAY_KEY_EVENT_PRESS = 1, > > - SPICE_DISPLAY_KEY_EVENT_RELEASE = 2, > > - SPICE_DISPLAY_KEY_EVENT_CLICK = 3, > > + SPICE_DISPLAY_KEY_EVENT_PRESS = 1, > > + SPICE_DISPLAY_KEY_EVENT_RELEASE = 2, > > + SPICE_DISPLAY_KEY_EVENT_CLICK = 3, > > } SpiceDisplayKeyEvent; > > > > -GType spice_display_get_type(void); > > +GType spice_display_get_type(void); > > > > SpiceDisplay* spice_display_new(SpiceSession *session, int channel_id); > > SpiceDisplay* spice_display_new_with_monitor(SpiceSession *session, gint > > channel_id, gint monitor_id); > > diff --git a/gtk/spicy-screenshot.c b/gtk/spicy-screenshot.c > > index e7835bf..1383f0d 100644 > > --- a/gtk/spicy-screenshot.c > > +++ b/gtk/spicy-screenshot.c > > @@ -56,8 +56,8 @@ static int write_ppm_32(void) > > > > fp = fopen(outf,"w"); > > if (NULL == fp) { > > - fprintf(stderr, _("%s: can't open %s: %s\n"), g_get_prgname(), > > outf, strerror(errno)); > > - return -1; > > + fprintf(stderr, _("%s: can't open %s: %s\n"), g_get_prgname(), > > outf, strerror(errno)); > > + return -1; > > } > > fprintf(fp, "P6\n%d %d\n255\n", > > d_width, d_height); > > diff --git a/gtk/spicy.c b/gtk/spicy.c > > index 2fcd529..4924411 100644 > > --- a/gtk/spicy.c > > +++ b/gtk/spicy.c > > @@ -788,14 +788,14 @@ static const GtkActionEntry entries[] = { > > .accelerator = "<shift>F11", > > },{ > > #ifdef USE_SMARTCARD > > - .name = "InsertSmartcard", > > - .label = N_("_Insert Smartcard"), > > - .callback = G_CALLBACK(menu_cb_insert_smartcard), > > + .name = "InsertSmartcard", > > + .label = N_("_Insert Smartcard"), > > + .callback = G_CALLBACK(menu_cb_insert_smartcard), > > .accelerator = "<shift>F8", > > },{ > > - .name = "RemoveSmartcard", > > - .label = N_("_Remove Smartcard"), > > - .callback = G_CALLBACK(menu_cb_remove_smartcard), > > + .name = "RemoveSmartcard", > > + .label = N_("_Remove Smartcard"), > > + .callback = G_CALLBACK(menu_cb_remove_smartcard), > > .accelerator = "<shift>F9", > > },{ > > #endif > > diff --git a/gtk/vncdisplaykeymap.c b/gtk/vncdisplaykeymap.c > > index 340a86f..450ea58 100644 > > --- a/gtk/vncdisplaykeymap.c > > +++ b/gtk/vncdisplaykeymap.c > > @@ -55,9 +55,9 @@ > > * to vncserver > > */ > > static struct { > > - GdkKeymapKey *keys; > > - gint n_keys; > > - guint keyval; > > + GdkKeymapKey *keys; > > + gint n_keys; > > + guint keyval; > > } untranslated_keys[] = {{NULL, 0, GDK_Tab}}; > > > > static unsigned int ref_count_for_untranslated_keys = 0; > > @@ -131,30 +131,30 @@ static unsigned int ref_count_for_untranslated_keys > > = 0; > > > > static gboolean check_for_xwin(GdkDisplay *dpy) > > { > > - char *vendor = ServerVendor(gdk_x11_display_get_xdisplay(dpy)); > > + char *vendor = ServerVendor(gdk_x11_display_get_xdisplay(dpy)); > > > > - if (strstr(vendor, "Cygwin/X")) > > - return TRUE; > > + if (strstr(vendor, "Cygwin/X")) > > + return TRUE; > > > > - return FALSE; > > + return FALSE; > > } > > > > static gboolean check_for_xquartz(GdkDisplay *dpy) > > { > > - int nextensions; > > - int i; > > - gboolean match = FALSE; > > - char **extensions = > > XListExtensions(gdk_x11_display_get_xdisplay(dpy), > > - &nextensions); > > - for (i = 0 ; extensions != NULL && i < nextensions ; i++) { > > - if (strcmp(extensions[i], "Apple-WM") == 0 || > > - strcmp(extensions[i], "Apple-DRI") == 0) > > - match = TRUE; > > - } > > - if (extensions) > > - XFreeExtensionList(extensions); > > + int nextensions; > > + int i; > > + gboolean match = FALSE; > > + char **extensions = > > XListExtensions(gdk_x11_display_get_xdisplay(dpy), > > + &nextensions); > > + for (i = 0 ; extensions != NULL && i < nextensions ; i++) { > > + if (strcmp(extensions[i], "Apple-WM") == 0 || > > + strcmp(extensions[i], "Apple-DRI") == 0) > > + match = TRUE; > > + } > > + if (extensions) > > + XFreeExtensionList(extensions); > > > > - return match; > > + return match; > > } > > #endif > > > > @@ -162,156 +162,156 @@ const guint16 > > *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window, > > size_t *maplen) > > { > > #ifdef GDK_WINDOWING_X11 > > - if (GDK_IS_X11_WINDOW(window)) { > > - XkbDescPtr desc; > > - const gchar *keycodes = NULL; > > + if (GDK_IS_X11_WINDOW(window)) { > > + XkbDescPtr desc; > > + const gchar *keycodes = NULL; > > GdkDisplay *dpy = gdk_window_get_display(window); > > > > - /* There is no easy way to determine what X11 server > > - * and platform & keyboard driver is in use. Thus we > > - * do best guess heuristics. > > - * > > - * This will need more work for people with other > > - * X servers..... patches welcomed. > > - */ > > + /* There is no easy way to determine what X11 server > > + * and platform & keyboard driver is in use. Thus we > > + * do best guess heuristics. > > + * > > + * This will need more work for people with other > > + * X servers..... patches welcomed. > > + */ > > > > - desc = XkbGetKeyboard(gdk_x11_display_get_xdisplay(dpy), > > - XkbGBN_AllComponentsMask, > > - XkbUseCoreKbd); > > - if (desc) { > > - if (desc->names) { > > - keycodes = > > gdk_x11_get_xatom_name(desc->names->keycodes); > > - if (!keycodes) > > - g_warning("could not lookup > > keycode name"); > > - } > > - XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, > > True); > > - } > > + desc = XkbGetKeyboard(gdk_x11_display_get_xdisplay(dpy), > > + XkbGBN_AllComponentsMask, > > + XkbUseCoreKbd); > > + if (desc) { > > + if (desc->names) { > > + keycodes = > > gdk_x11_get_xatom_name(desc->names->keycodes); > > + if (!keycodes) > > + g_warning("could not lookup > > keycode name"); > > + } > > + XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, > > True); > > + } > > > > - if (check_for_xwin(dpy)) { > > - VNC_DEBUG("Using xwin keycode mapping"); > > - *maplen = G_N_ELEMENTS(keymap_xorgxwin2xtkbd); > > - return keymap_xorgxwin2xtkbd; > > - } else if (check_for_xquartz(dpy)) { > > - VNC_DEBUG("Using xquartz keycode mapping"); > > - *maplen = G_N_ELEMENTS(keymap_xorgxquartz2xtkbd); > > - return keymap_xorgxquartz2xtkbd; > > - } else if (keycodes && STRPREFIX(keycodes, "evdev_")) { > > - VNC_DEBUG("Using evdev keycode mapping"); > > - *maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd); > > - return keymap_xorgevdev2xtkbd; > > - } else if (keycodes && STRPREFIX(keycodes, "xfree86_")) { > > - VNC_DEBUG("Using xfree86 keycode mapping"); > > - *maplen = G_N_ELEMENTS(keymap_xorgkbd2xtkbd); > > - return keymap_xorgkbd2xtkbd; > > - } else { > > - g_warning("Unknown keycode mapping '%s'.\n" > > - "Please report to gtk-vnc-list@xxxxxxxxx > > \n" > > - "including the following information:\n" > > - "\n" > > - " - Operating system\n" > > - " - GDK build\n" > > - " - X11 Server\n" > > - " - xprop -root\n" > > - " - xdpyinfo\n", > > - keycodes); > > - return NULL; > > - } > > - } > > + if (check_for_xwin(dpy)) { > > + VNC_DEBUG("Using xwin keycode mapping"); > > + *maplen = G_N_ELEMENTS(keymap_xorgxwin2xtkbd); > > + return keymap_xorgxwin2xtkbd; > > + } else if (check_for_xquartz(dpy)) { > > + VNC_DEBUG("Using xquartz keycode mapping"); > > + *maplen = G_N_ELEMENTS(keymap_xorgxquartz2xtkbd); > > + return keymap_xorgxquartz2xtkbd; > > + } else if (keycodes && STRPREFIX(keycodes, "evdev_")) { > > + VNC_DEBUG("Using evdev keycode mapping"); > > + *maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd); > > + return keymap_xorgevdev2xtkbd; > > + } else if (keycodes && STRPREFIX(keycodes, "xfree86_")) { > > + VNC_DEBUG("Using xfree86 keycode mapping"); > > + *maplen = G_N_ELEMENTS(keymap_xorgkbd2xtkbd); > > + return keymap_xorgkbd2xtkbd; > > + } else { > > + g_warning("Unknown keycode mapping '%s'.\n" > > + "Please report to > > gtk-vnc-list@xxxxxxxxx\n" > > + "including the following information:\n" > > + "\n" > > + " - Operating system\n" > > + " - GDK build\n" > > + " - X11 Server\n" > > + " - xprop -root\n" > > + " - xdpyinfo\n", > > + keycodes); > > + return NULL; > > + } > > + } > > #endif > > > > #ifdef GDK_WINDOWING_WIN32 > > - if (GDK_IS_WIN32_WINDOW(window)) { > > - VNC_DEBUG("Using Win32 virtual keycode mapping"); > > - *maplen = G_N_ELEMENTS(keymap_win322xtkbd); > > - return keymap_win322xtkbd; > > - } > > + if (GDK_IS_WIN32_WINDOW(window)) { > > + VNC_DEBUG("Using Win32 virtual keycode mapping"); > > + *maplen = G_N_ELEMENTS(keymap_win322xtkbd); > > + return keymap_win322xtkbd; > > + } > > #endif > > > > #ifdef GDK_WINDOWING_QUARTZ > > - if (GDK_IS_QUARTZ_WINDOW(window)) { > > - VNC_DEBUG("Using OS-X virtual keycode mapping"); > > - *maplen = G_N_ELEMENTS(keymap_osx2xtkbd); > > - return keymap_osx2xtkbd; > > - } > > + if (GDK_IS_QUARTZ_WINDOW(window)) { > > + VNC_DEBUG("Using OS-X virtual keycode mapping"); > > + *maplen = G_N_ELEMENTS(keymap_osx2xtkbd); > > + return keymap_osx2xtkbd; > > + } > > #endif > > > > #ifdef GDK_WINDOWING_WAYLAND > > - if (GDK_IS_WAYLAND_WINDOW(window)) { > > - VNC_DEBUG("Using Wayland Xorg/evdev virtual keycode > > mapping"); > > - *maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd); > > - return keymap_xorgevdev2xtkbd; > > + if (GDK_IS_WAYLAND_WINDOW(window)) { > > + VNC_DEBUG("Using Wayland Xorg/evdev virtual keycode > > mapping"); > > + *maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd); > > + return keymap_xorgevdev2xtkbd; > > } > > #endif > > > > #ifdef GDK_WINDOWING_BROADWAY > > - if (GDK_IS_BROADWAY_WINDOW(window)) { > > + if (GDK_IS_BROADWAY_WINDOW(window)) { > > g_warning("experimental: using broadway, x11 virtual > > keysym mapping - with very limited support. See also > > https://bugzilla.gnome.org/show_bug.cgi?id=700105"); > > > > - *maplen = G_N_ELEMENTS(keymap_x112xtkbd); > > - return keymap_x112xtkbd; > > + *maplen = G_N_ELEMENTS(keymap_x112xtkbd); > > + return keymap_x112xtkbd; > > } > > #endif > > > > - g_warning("Unsupported GDK Windowing platform.\n" > > - "Disabling extended keycode tables.\n" > > - "Please report to gtk-vnc-list@xxxxxxxxx\n" > > - "including the following information:\n" > > - "\n" > > - " - Operating system\n" > > - " - GDK Windowing system build\n"); > > - return NULL; > > + g_warning("Unsupported GDK Windowing platform.\n" > > + "Disabling extended keycode tables.\n" > > + "Please report to gtk-vnc-list@xxxxxxxxx\n" > > + "including the following information:\n" > > + "\n" > > + " - Operating system\n" > > + " - GDK Windowing system build\n"); > > + return NULL; > > } > > > > guint16 vnc_display_keymap_gdk2xtkbd(const guint16 *keycode_map, > > - size_t keycode_maplen, > > - guint16 keycode) > > + size_t keycode_maplen, > > + guint16 keycode) > > { > > - if (!keycode_map) > > - return 0; > > - if (keycode >= keycode_maplen) > > - return 0; > > - return keycode_map[keycode]; > > + if (!keycode_map) > > + return 0; > > + if (keycode >= keycode_maplen) > > + return 0; > > + return keycode_map[keycode]; > > } > > > > /* Set the keymap entries */ > > void vnc_display_keyval_set_entries(void) > > { > > - size_t i; > > - if (ref_count_for_untranslated_keys == 0) > > - for (i = 0; i < sizeof(untranslated_keys) / > > sizeof(untranslated_keys[0]); i++) > > - > > gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), > > - > > untranslated_keys[i].keyval, > > - > > &untranslated_keys[i].keys, > > - > > &untranslated_keys[i].n_keys); > > - ref_count_for_untranslated_keys++; > > + size_t i; > > + if (ref_count_for_untranslated_keys == 0) > > + for (i = 0; i < sizeof(untranslated_keys) / > > sizeof(untranslated_keys[0]); i++) > > + > > gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), > > + > > untranslated_keys[i].keyval, > > + > > &untranslated_keys[i].keys, > > + > > &untranslated_keys[i].n_keys); > > + ref_count_for_untranslated_keys++; > > } > > > > /* Free the keymap entries */ > > void vnc_display_keyval_free_entries(void) > > { > > - size_t i; > > + size_t i; > > > > - if (ref_count_for_untranslated_keys == 0) > > - return; > > + if (ref_count_for_untranslated_keys == 0) > > + return; > > > > - ref_count_for_untranslated_keys--; > > - if (ref_count_for_untranslated_keys == 0) > > - for (i = 0; i < sizeof(untranslated_keys) / > > sizeof(untranslated_keys[0]); i++) > > - g_free(untranslated_keys[i].keys); > > + ref_count_for_untranslated_keys--; > > + if (ref_count_for_untranslated_keys == 0) > > + for (i = 0; i < sizeof(untranslated_keys) / > > sizeof(untranslated_keys[0]); i++) > > + g_free(untranslated_keys[i].keys); > > > > } > > > > /* Get the keyval from the keycode without the level. */ > > guint vnc_display_keyval_from_keycode(guint keycode, guint keyval) > > { > > - size_t i; > > - for (i = 0; i < sizeof(untranslated_keys) / > > sizeof(untranslated_keys[0]); i++) { > > - if (keycode == untranslated_keys[i].keys[0].keycode) { > > - return untranslated_keys[i].keyval; > > - } > > - } > > + size_t i; > > + for (i = 0; i < sizeof(untranslated_keys) / > > sizeof(untranslated_keys[0]); i++) { > > + if (keycode == untranslated_keys[i].keys[0].keycode) { > > + return untranslated_keys[i].keyval; > > + } > > + } > > > > - return keyval; > > + return keyval; > > } > > /* > > * Local variables: > > -- > > 2.1.0 > > > > _______________________________________________ > > Spice-devel mailing list > > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > > http://lists.freedesktop.org/mailman/listinfo/spice-devel > > > > > > -- > Marc-André Lureau
Attachment:
pgpuZWCF4yMQx.pgp
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel