gnome-mud r802 - in trunk: . src src/zmp
- From: lharris svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-mud r802 - in trunk: . src src/zmp
- Date: Wed, 18 Mar 2009 08:49:29 +0000 (UTC)
Author: lharris
Date: Wed Mar 18 08:49:29 2009
New Revision: 802
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=802&view=rev
Log:
Moved resized signals to size-allocate
Modified:
trunk/ChangeLog
trunk/src/mud-subwindow.c
trunk/src/mud-window.c
trunk/src/zmp/zmp-subwindow.c
Modified: trunk/src/mud-subwindow.c
==============================================================================
--- trunk/src/mud-subwindow.c (original)
+++ trunk/src/mud-subwindow.c Wed Mar 18 08:49:29 2009
@@ -40,6 +40,8 @@
guint width;
guint height;
+ guint old_width;
+ guint old_height;
gboolean visible;
gboolean input_enabled;
@@ -56,6 +58,8 @@
GtkWidget *scroll;
GtkWidget *vbox;
+ gint x, y;
+
MudConnectionView *parent_view;
};
@@ -75,7 +79,9 @@
PROP_WIDTH,
PROP_HEIGHT,
PROP_VISIBLE,
- PROP_INPUT
+ PROP_INPUT,
+ PROP_OLD_WIDTH,
+ PROP_OLD_HEIGHT
};
/* Signal Indices */
@@ -121,6 +127,11 @@
GdkEventConfigure *event,
gpointer user_data);
+static void mud_subwindow_size_allocate_cb(GtkWidget *widget,
+ GtkAllocation *allocation,
+ MudSubwindow *self);
+
+
/* Private Methods */
static void mud_subwindow_set_size_force_grid (MudSubwindow *window,
VteTerminal *screen,
@@ -202,6 +213,26 @@
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(object_class,
+ PROP_OLD_HEIGHT,
+ g_param_spec_uint("old-height",
+ "Old Height",
+ "The old height of the terminal in rows.",
+ 0,
+ 1024,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_OLD_WIDTH,
+ g_param_spec_uint("old-width",
+ "Old Width",
+ "The old width of the terminal in rows.",
+ 0,
+ 1024,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
PROP_VISIBLE,
g_param_spec_boolean("visible",
"Visible",
@@ -261,6 +292,10 @@
self->priv->current_history_index = 0;
self->priv->width = 0;
self->priv->height = 0;
+ self->priv->old_width = 0;
+ self->priv->old_height = 0;
+ self->priv->x = 0;
+ self->priv->y = 0;
self->priv->window = NULL;
self->priv->entry = NULL;
@@ -314,6 +349,9 @@
g_error("Tried to instantiate MudSubwindow without passing valid width/height.");
}
+ self->priv->old_width = self->priv->width;
+ self->priv->old_height = self->priv->height;
+
/* start glading */
glade = glade_xml_new(GLADEDIR "/main.glade", "subwindow", NULL);
@@ -389,6 +427,11 @@
G_CALLBACK(mud_subwindow_configure_event_cb),
self);
+ g_signal_connect(self->priv->window,
+ "size-allocate",
+ G_CALLBACK(mud_subwindow_size_allocate_cb),
+ self);
+
g_signal_connect(self->priv->entry,
"key_press_event",
G_CALLBACK(mud_subwindow_entry_keypress_cb),
@@ -474,6 +517,20 @@
self->priv->width = new_uint;
break;
+ case PROP_OLD_HEIGHT:
+ new_uint = g_value_get_uint(value);
+
+ if(new_uint != self->priv->old_height)
+ self->priv->old_height = new_uint;
+ break;
+
+ case PROP_OLD_WIDTH:
+ new_uint = g_value_get_uint(value);
+
+ if(new_uint != self->priv->old_width)
+ self->priv->old_width = new_uint;
+ break;
+
case PROP_IDENT:
new_string = g_value_dup_string(value);
@@ -542,6 +599,14 @@
g_value_set_uint(value, self->priv->height);
break;
+ case PROP_OLD_HEIGHT:
+ g_value_set_uint(value, self->priv->old_height);
+ break;
+
+ case PROP_OLD_WIDTH:
+ g_value_set_uint(value, self->priv->old_width);
+ break;
+
case PROP_VISIBLE:
g_value_set_boolean(value, self->priv->visible);
break;
@@ -749,25 +814,35 @@
{
MudSubwindow *self = MUD_SUBWINDOW(user_data);
- if(event->width != self->priv->pixel_width ||
- event->height != self->priv->pixel_height)
+ if(event->x != self->priv->x ||
+ event->y != self->priv->y)
{
- self->priv->pixel_width = event->width;
- self->priv->pixel_height = event->height;
+ self->priv->x = event->x;
+ self->priv->y = event->y;
+ }
+
+ gtk_widget_grab_focus(self->priv->entry);
+
+ return FALSE;
+}
+static void
+mud_subwindow_size_allocate_cb(GtkWidget *widget,
+ GtkAllocation *allocation,
+ MudSubwindow *self)
+{
+ if(self->priv->width != allocation->width ||
+ self->priv->height != allocation->height)
+ {
self->priv->width = VTE_TERMINAL(self->priv->terminal)->column_count;
self->priv->height = VTE_TERMINAL(self->priv->terminal)->row_count;
g_signal_emit(self,
- mud_subwindow_signal[RESIZED],
- 0,
- self->priv->width,
- self->priv->height);
+ mud_subwindow_signal[RESIZED],
+ 0,
+ self->priv->width,
+ self->priv->height);
}
-
- gtk_widget_grab_focus(self->priv->entry);
-
- return FALSE;
}
static gboolean
@@ -870,6 +945,9 @@
g_return_if_fail(MUD_IS_SUBWINDOW(self));
gtk_widget_show(self->priv->window);
+ gtk_window_move(GTK_WINDOW(self->priv->window),
+ self->priv->x,
+ self->priv->y);
self->priv->visible = TRUE;
}
Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c (original)
+++ trunk/src/mud-window.c Wed Mar 18 08:49:29 2009
@@ -142,6 +142,9 @@
static void mud_window_profile_menu_set_cb(GtkWidget *widget, gpointer data);
static void mud_window_startlog_cb(GtkWidget *widget, MudWindow *self);
static void mud_window_stoplog_cb(GtkWidget *widget, MudWindow *self);
+static void mud_window_size_allocate_cb(GtkWidget *widget,
+ GtkAllocation *allocation,
+ MudWindow *self);
/* Private Method Prototypes */
static void mud_window_remove_connection_view(MudWindow *self, gint nr);
@@ -323,6 +326,11 @@
G_CALLBACK(mud_window_configure_event),
self);
+ g_signal_connect(self->window,
+ "size-allocate",
+ G_CALLBACK(mud_window_size_allocate_cb),
+ self);
+
g_signal_connect(self->priv->textview,
"key_press_event",
G_CALLBACK(mud_window_textview_keypress),
@@ -741,11 +749,21 @@
g_object_unref(buf);
}
- if(event->width != self->priv->width ||
- event->height != self->priv->height)
+ gtk_widget_grab_focus(self->priv->textview);
+
+ return FALSE;
+}
+
+static void
+mud_window_size_allocate_cb(GtkWidget *widget,
+ GtkAllocation *allocation,
+ MudWindow *self)
+{
+ if(self->priv->width != allocation->width ||
+ self->priv->height != allocation->height)
{
- self->priv->width = event->width;
- self->priv->height = event->height;
+ self->priv->width = allocation->width;
+ self->priv->height = allocation->height;
g_signal_emit(self,
mud_window_signal[RESIZED],
@@ -753,10 +771,6 @@
self->priv->width,
self->priv->height);
}
-
- gtk_widget_grab_focus(self->priv->textview);
-
- return FALSE;
}
static void
Modified: trunk/src/zmp/zmp-subwindow.c
==============================================================================
--- trunk/src/zmp/zmp-subwindow.c (original)
+++ trunk/src/zmp/zmp-subwindow.c Wed Mar 18 08:49:29 2009
@@ -305,6 +305,11 @@
pkg);
}
+ g_object_set(sub,
+ "old-width", (guint)atol(argv[3]),
+ "old-height", (guint)atol(argv[4]),
+ NULL);
+
mud_zmp_send_command(self, 4,
"subwindow.size",
argv[1],
@@ -380,19 +385,34 @@
{
gchar *identifier;
gchar *w, *h;
+ guint old_w, old_h;
- g_object_get(sub, "identifier", &identifier, NULL);
- w = g_strdup_printf("%d", width);
- h = g_strdup_printf("%d", height);
-
- mud_zmp_send_command(self->priv->parent, 4,
- "subwindow.size",
- identifier,
- w,
- h);
+ g_object_get(sub,
+ "old-width", &old_w,
+ "old-height", &old_h,
+ NULL);
- g_free(w);
- g_free(h);
- g_free(identifier);
+ if(width != old_w ||
+ height != old_h)
+ {
+ g_object_get(sub, "identifier", &identifier, NULL);
+ g_object_set(sub,
+ "old-width", width,
+ "old-height", height,
+ NULL);
+
+ w = g_strdup_printf("%d", width);
+ h = g_strdup_printf("%d", height);
+
+ mud_zmp_send_command(self->priv->parent, 4,
+ "subwindow.size",
+ identifier,
+ w,
+ h);
+
+ g_free(w);
+ g_free(h);
+ g_free(identifier);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]