[Spice-devel] [PATCH] gtk: Remove redundant code
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Tue May 10 07:02:52 PDT 2011
No need to keep the code that it disabled since it harms readability.
Also remove the '#if 1' for same rationale.
---
gtk/channel-display.c | 3 +-
gtk/channel-main.c | 6 ----
gtk/coroutine_gthread.c | 4 ---
gtk/coroutine_ucontext.c | 5 ---
gtk/decode-glz.c | 4 ---
gtk/spice-widget.c | 67 ----------------------------------------------
gtk/spicy.c | 33 ----------------------
7 files changed, 1 insertions(+), 121 deletions(-)
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index b3ac5c0..072373d 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -463,9 +463,8 @@ static void image_put_lossy(SpiceImageCache *cache, uint64_t id,
SPICE_CONTAINEROF(cache, spice_display_channel, image_cache);
display_cache_item *item;
-#if 1 /* TODO: temporary sanity check */
+ /* TODO: temporary sanity check */
g_warn_if_fail(cache_find(c->images, id) == NULL);
-#endif
item = cache_add(c->images, id);
item->ptr = pixman_image_ref(surface);
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index c33851c..6897a18 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -845,12 +845,6 @@ static void agent_display_config(SpiceMainChannel *channel)
config.depth = c->display_color_depth;
}
-#if 0 // TODO
- if (!_display_setting.is_empty()) {
- _agent_reply_wait_type = VD_AGENT_DISPLAY_CONFIG;
- }
-#endif
-
SPICE_DEBUG("display_config: flags: %u, depth: %u", config.flags, config.depth);
agent_msg_queue(channel, VD_AGENT_DISPLAY_CONFIG, sizeof(VDAgentDisplayConfig), &config);
diff --git a/gtk/coroutine_gthread.c b/gtk/coroutine_gthread.c
index 14231a0..0e30a9a 100644
--- a/gtk/coroutine_gthread.c
+++ b/gtk/coroutine_gthread.c
@@ -29,11 +29,7 @@ static GMutex *run_lock;
static struct coroutine *current;
static struct coroutine leader;
-#if 0
-#define CO_DEBUG(OP) fprintf(stderr, "%s %p %s %d\n", OP, g_thread_self(), __FUNCTION__, __LINE__)
-#else
#define CO_DEBUG(OP)
-#endif
static void coroutine_system_init(void)
{
diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c
index 91059ad..80b3246 100644
--- a/gtk/coroutine_ucontext.c
+++ b/gtk/coroutine_ucontext.c
@@ -71,13 +71,8 @@ int coroutine_init(struct coroutine *co)
return cc_init(&co->cc);
}
-#if 0
-static __thread struct coroutine leader;
-static __thread struct coroutine *current;
-#else
static struct coroutine leader;
static struct coroutine *current;
-#endif
struct coroutine *coroutine_self(void)
{
diff --git a/gtk/decode-glz.c b/gtk/decode-glz.c
index 5a3e06a..f1dde6e 100644
--- a/gtk/decode-glz.c
+++ b/gtk/decode-glz.c
@@ -118,10 +118,6 @@ static void glz_decoder_window_add(SpiceGlzDecoderWindow *w,
slot = img->hdr.id % w->nimages;
}
-#if 0
- SPICE_DEBUG("%s: %d %" PRId64, __FUNCTION__, slot, img->hdr.id);
-#endif
-
w->images[slot] = img;
}
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 5cfe811..6421973 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -327,7 +327,6 @@ static void try_keyboard_grab(SpiceDisplay *display)
if (!d->mouse_have_pointer)
return;
-#if 1
/*
* == DEBUG ==
* focus / keyboard grab behavior is funky
@@ -348,7 +347,6 @@ static void try_keyboard_grab(SpiceDisplay *display)
__FUNCTION__);
return;
}
-#endif
SPICE_DEBUG("grab keyboard");
@@ -614,14 +612,6 @@ static gboolean expose_event(GtkWidget *widget, GdkEventExpose *expose)
SpiceDisplay *display = SPICE_DISPLAY(widget);
spice_display *d = SPICE_DISPLAY_GET_PRIVATE(display);
-#if 0
- SPICE_DEBUG("%s: area %dx%d at %d,%d", __FUNCTION__,
- expose->area.width,
- expose->area.height,
- expose->area.x,
- expose->area.y);
-#endif
-
if (d->mark == 0 || d->data == NULL)
return false;
@@ -1964,63 +1954,6 @@ typedef enum SpiceLed {
SCROLL_LOCK_LED,
} SpiceLed;
-#if 0
-static guint get_modifier_mask(Display *x_display, KeySym modifier)
-{
- int mask = 0;
- int i;
-
- XModifierKeymap* map = XGetModifierMapping(x_display);
- KeyCode keycode = XKeysymToKeycode(x_display, modifier);
- if (keycode == NoSymbol) {
- return 0;
- }
-
- for (i = 0; i < 8; i++) {
- if (map->modifiermap[map->max_keypermod * i] == keycode) {
- mask = 1 << i;
- }
- }
- XFreeModifiermap(map);
- return mask;
-}
-
-static void set_keyboard_led(Display *x_display, SpiceLed led, int set)
-{
- guint mask;
- XKeyboardControl keyboard_control;
-
- switch (led) {
- case CAPS_LOCK_LED:
- if ((mask = get_modifier_mask(x_display, XK_Caps_Lock)) != 0) {
- XkbLockModifiers(x_display, XkbUseCoreKbd, mask, set ? mask : 0);
- }
- return;
- case NUM_LOCK_LED:
- if ((mask = get_modifier_mask(x_display, XK_Num_Lock)) != 0) {
- XkbLockModifiers(x_display, XkbUseCoreKbd, mask, set ? mask : 0);
- }
- return;
- case SCROLL_LOCK_LED:
- keyboard_control.led_mode = set ? LedModeOn : LedModeOff;
- keyboard_control.led = led;
- XChangeKeyboardControl(x_display, KBLed | KBLedMode, &keyboard_control);
- return;
- }
-}
-
-static void spice_set_keyboard_lock_modifiers(SpiceDisplay *display, uint32_t modifiers)
-{
- Display *x_display;
-
- x_display = GDK_WINDOW_XDISPLAY(gtk_widget_get_parent_window(GTK_WIDGET(display)));
-
- set_keyboard_led(x_display, CAPS_LOCK_LED, !!(modifiers & SPICE_INPUTS_CAPS_LOCK));
- set_keyboard_led(x_display, NUM_LOCK_LED, !!(modifiers & SPICE_INPUTS_NUM_LOCK));
- set_keyboard_led(x_display, SCROLL_LOCK_LED, !!(modifiers & SPICE_INPUTS_SCROLL_LOCK));
-}
-#endif
-
static void sync_keyboard_lock_modifiers(SpiceDisplay *display)
{
Display *x_display;
diff --git a/gtk/spicy.c b/gtk/spicy.c
index 1ec0381..5035d07 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -395,17 +395,6 @@ static gboolean delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
return true;
}
-static void destroy_cb(GtkWidget *widget, gpointer data)
-{
-#if 0
- struct spice_window *win = data;
-
- if (win->id == 0) {
- g_main_loop_quit(mainloop);
- }
-#endif
-}
-
static gboolean window_state_cb(GtkWidget *widget, GdkEventWindowState *event,
gpointer data)
{
@@ -755,26 +744,6 @@ get_output_for_window(GnomeRRConfig *configuration, GdkWindow *window)
win_rect.y + win_rect.height / 2);
}
-#if 0
-static GnomeRROutputInfo *get_primary_output() {
- GnomeRROutputInfo **outputs;
- GnomeRROutputInfo *output;
- guint i;
-
- outputs = gnome_rr_config_get_outputs (rrcurrent);
- for (i = 0; outputs[i] != NULL; ++i) {
- output = outputs[i];
- if (!gnome_rr_output_info_is_connected (output))
- continue;
- if (gnome_rr_output_info_get_primary (output))
- break;
- }
- output = outputs[i];
- g_return_if_fail(output != NULL);
- return output;
-}
-#endif
-
static void
on_screen_changed(GnomeRRScreen *scr, gpointer data)
{
@@ -921,8 +890,6 @@ static spice_window *create_spice_window(spice_connection *conn, int id, SpiceCh
G_CALLBACK(window_state_cb), win);
g_signal_connect(G_OBJECT(win->toplevel), "delete-event",
G_CALLBACK(delete_cb), win);
- g_signal_connect(G_OBJECT(win->toplevel), "destroy",
- G_CALLBACK(destroy_cb), win);
/* menu + toolbar */
win->ui = gtk_ui_manager_new();
--
1.7.5.1
More information about the Spice-devel
mailing list