Commit 49044eda authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Remove tearoff menus, they sucked. We can readd them when we implement

Thu Jan 10 23:27:54 2002  George Lebl <jirka@5z.com>

	* Makefile.am, foobar-widget.c, menu.[ch], panel-config.c,
	  panel-util.c, panel.c, session.c, tearoffitem.[ch]:
	  Remove tearoff menus, they sucked.  We can readd them when
	  we implement them properly.

	* gnome-run.c:  Port to TreeView, so we are now completely
	  de-deprecated.  Also read from all-applications:/  To
	  actually allways get all entries.
parent 1abec36f
Thu Jan 10 23:27:54 2002 George Lebl <jirka@5z.com>
* Makefile.am, foobar-widget.c, menu.[ch], panel-config.c,
panel-util.c, panel.c, session.c, tearoffitem.[ch]:
Remove tearoff menus, they sucked. We can readd them when
we implement them properly.
* gnome-run.c: Port to TreeView, so we are now completely
de-deprecated. Also read from all-applications:/ To
actually allways get all entries.
2002-01-11 Glynn Foster <glynn.foster@sun.com>
* applet.c, drawer.c, drawer.h, gnome-panel-properties.c,
......
......@@ -73,7 +73,6 @@ panel_sources = \
sliding-widget.c \
floating-widget.c \
rgb-stuff.c \
tearoffitem.c \
panel.c \
applet.c \
logout.c \
......@@ -113,7 +112,6 @@ panel_headers = \
sliding-widget.h \
floating-widget.h \
rgb-stuff.h \
tearoffitem.h \
panel.h \
applet.h \
logout.h \
......
......@@ -128,17 +128,6 @@ pixmap_menu_item_new (const char *text, const char *try_file, gboolean force_ima
return item;
}
static void
add_tearoff (GtkMenuShell *menu)
{
GtkWidget *item;
item = gtk_tearoff_menu_item_new ();
if (panel_menu_have_tearoff ())
gtk_widget_show (item);
gtk_menu_shell_prepend (menu, item);
}
static gboolean
foobar_leave_notify (GtkWidget *widget,
GdkEventCrossing *event)
......@@ -183,8 +172,6 @@ append_actions_menu (GtkWidget *menu_bar)
menu = panel_menu_new ();
add_tearoff (GTK_MENU_SHELL (menu));
menu = panel_menu_new ();
item = pixmap_menu_item_new (_("Run..."), "gnome-run.png",
......@@ -225,8 +212,6 @@ append_actions_menu (GtkWidget *menu_bar)
G_CALLBACK (panel_quit), 0);
setup_internal_applet_drag (item, "LOGOUT:NEW");
add_tearoff (GTK_MENU_SHELL (menu));
item = gtk_menu_item_new_with_label (_("Actions"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), item);
......@@ -496,14 +481,10 @@ append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar)
menu2 = panel_menu_new ();
append_format_items (menu2);
add_tearoff (GTK_MENU_SHELL (menu2));
item = gtk_image_menu_item_new_with_label (_("Format"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu2);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
add_tearoff (GTK_MENU_SHELL (menu));
item = gtk_menu_item_new ();
foo->clock_label = gtk_label_new ("");
......@@ -617,7 +598,7 @@ programs_menu_to_display (GtkWidget *menu)
flags |= MAIN_MENU_KDE_SUB;
if (got_distro_menus ())
flags |= MAIN_MENU_DISTRIBUTION_SUB;
create_root_menu (menu, TRUE, flags, TRUE, FALSE, FALSE /* run_item */);
create_root_menu (menu, TRUE, flags, FALSE, FALSE /* run_item */);
}
}
......@@ -1061,7 +1042,7 @@ foobar_widget_instance_init (FoobarWidget *foo)
if (got_distro_menus ())
flags |= MAIN_MENU_DISTRIBUTION_SUB;
menu = create_root_menu (NULL, TRUE, flags, TRUE, FALSE, FALSE /* run_item */);
menu = create_root_menu (NULL, TRUE, flags, FALSE, FALSE /* run_item */);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menuitem);
g_signal_connect (G_OBJECT (menu), "show",
......
......@@ -21,9 +21,6 @@
* USA
*/
/* FIXME: because of CList */
#undef GTK_DISABLE_DEPRECATED
#include <config.h>
#include <errno.h>
#include <sys/types.h>
......@@ -52,6 +49,16 @@
#define ADVANCED_DIALOG_KEY "advanced_run_dialog"
#define ICON_SIZE 20
enum {
COLUMN_ICON,
COLUMN_FULLNAME,
COLUMN_COMMENT,
COLUMN_NAME,
NUM_COLUMNS
};
extern GtkTooltips *panel_tooltips;
extern gboolean no_run_box;
......@@ -193,7 +200,7 @@ static void
run_dialog_response (GtkWidget *w, int response, gpointer data)
{
GtkEntry *entry;
GtkWidget *clist;
GtkWidget *list;
GtkToggleButton *terminal;
char **argv = NULL;
char **temp_argv = NULL;
......@@ -213,23 +220,35 @@ run_dialog_response (GtkWidget *w, int response, gpointer data)
goto return_and_close;
}
clist = g_object_get_data (G_OBJECT (run_dialog), "dentry_list");
list = g_object_get_data (G_OBJECT (run_dialog), "dentry_list");
terminal = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT(w),
"terminal"));
if (g_object_get_data (G_OBJECT (run_dialog), "use_list")) {
char *name;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
GValue value = {0, };
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
if (GTK_CLIST (clist)->selection == NULL)
/* just return if nothing selected */
if ( ! gtk_tree_selection_get_selected (selection,
&model, &iter))
return;
name = gtk_clist_get_row_data (GTK_CLIST (clist),
GPOINTER_TO_INT (GTK_CLIST (clist)->selection->data));
gtk_tree_model_get_value (model, &iter,
COLUMN_NAME,
&value);
name = g_strdup (g_value_get_string (&value));
g_value_unset (&value);
if (name != NULL) {
GError *error = NULL;
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name,
ditem = gnome_desktop_item_new_from_uri (name,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
&error);
if (ditem != NULL) {
......@@ -257,6 +276,8 @@ run_dialog_response (GtkWidget *w, int response, gpointer data)
if (ditem != NULL) {
gnome_desktop_item_unref (ditem);
}
g_free (name);
}
} else {
entry = GTK_ENTRY (g_object_get_data (G_OBJECT (w), "entry"));
......@@ -477,26 +498,37 @@ sync_entry_to_list (GtkWidget *dialog)
static void
sync_list_to_entry (GtkWidget *dialog)
{
GtkWidget *clist;
GtkWidget *list;
GtkWidget *entry;
GtkWidget *terminal_toggle;
gchar *name;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
g_object_set_data (G_OBJECT (dialog),
"sync_entry_to_list_blocked",
GINT_TO_POINTER (TRUE));
clist = g_object_get_data (G_OBJECT (dialog), "dentry_list");
list = g_object_get_data (G_OBJECT (dialog), "dentry_list");
entry = g_object_get_data (G_OBJECT (dialog), "entry");
terminal_toggle = g_object_get_data (G_OBJECT (dialog), "terminal");
if (GTK_CLIST (clist)->selection) {
name = gtk_clist_get_row_data (GTK_CLIST (clist),
GPOINTER_TO_INT (GTK_CLIST (clist)->selection->data));
if (name) {
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
GValue value = {0, };
gtk_tree_model_get_value (model, &iter,
COLUMN_NAME,
&value);
name = g_strdup (g_value_get_string (&value));
g_value_unset (&value);
if (name != NULL) {
GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name,
ditem = gnome_desktop_item_new_from_uri (name,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
NULL /* error */);
if (ditem != NULL) {
......@@ -520,6 +552,8 @@ sync_list_to_entry (GtkWidget *dialog)
gnome_desktop_item_unref (ditem);
}
g_free (name);
}
}
......@@ -659,103 +693,67 @@ create_advanced_contents (void)
return vbox;
}
static void
scan_dir_recurse (DirRec *dr,
GSList **entry_list)
{
GSList *li;
for (li = dr->recs; li != NULL; li = li->next) {
FileRec *fr = li->data;
if (fr->type == FILE_REC_FILE) {
if (fr->goad_id != NULL)
continue; /* applet */
*entry_list = g_slist_prepend (*entry_list, fr);
} else if (fr->type == FILE_REC_DIR) {
scan_dir_recurse ((DirRec*)fr, entry_list);
} else {
continue;
}
}
}
static int
sort_by_name (FileRec *fra,
FileRec *frb)
{
return strcoll (fra->fullname, frb->fullname);
/* FIXME: there is no utf8 strcoll afaik, so
* we just strcmp for now, this is evil, but
* it works mostly somewhat */
return strcmp (fra->fullname, frb->fullname);
}
#define CLIST_ICON_SIZE 20
static void
add_columns (GtkTreeView *treeview)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer = gtk_cell_renderer_pixbuf_new ();
column = gtk_tree_view_column_new_with_attributes (NULL,
renderer,
"pixbuf", COLUMN_ICON,
NULL);
gtk_tree_view_column_set_clickable (column, FALSE);
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column),
ICON_SIZE);
gtk_tree_view_append_column (treeview, column);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Applications"),
renderer,
"text",
COLUMN_FULLNAME,
NULL);
gtk_tree_view_column_set_clickable (column, FALSE);
gtk_tree_view_append_column (treeview, column);
}
/* Called when simple contents are switched to or first shown */
static void
simple_contents_shown (GtkWidget *vbox,
GtkWidget *dialog)
fill_list (GtkWidget *list)
{
GtkWidget *advanced;
GSList *entries;
GSList *tmp;
GSList *files;
GSList *prev;
GtkWidget *clist;
char *prev_name;
clist = g_object_get_data (G_OBJECT (dialog), "dentry_list");
advanced = g_object_get_data (G_OBJECT (dialog), "advanced");
if (advanced) {
/* If we have advanced contents containing a command,
* try to match that command to some desktop entry
* in order to fill in our default.
*/
/* FIXME */
}
if (GTK_CLIST (clist)->rows == 0) {
GdkPixmap *spacer_pixmap;
GdkBitmap *spacer_mask;
GdkGC *gc;
GdkColor color;
/* Create invisible pixmap/mask to put space
* before entries with no icon
*/
spacer_pixmap = gdk_pixmap_new (NULL,
CLIST_ICON_SIZE,
CLIST_ICON_SIZE,
gtk_widget_get_visual (clist)->depth);
spacer_mask = gdk_pixmap_new (NULL,
CLIST_ICON_SIZE,
CLIST_ICON_SIZE,
1);
gc = gdk_gc_new (spacer_mask);
color.pixel = 0;
gdk_gc_set_foreground (gc, &color);
gdk_draw_rectangle (spacer_mask,
gc,
TRUE, 0, 0, CLIST_ICON_SIZE, CLIST_ICON_SIZE);
g_object_unref (G_OBJECT (gc));
gc = NULL;
/* FIXME: this is not actually the list of all directories,
* as it only includes the cache, this just seems like all,
* this is wrong! */
entries = fr_get_all_dirs ();
GtkListStore *store;
FileRec *all_dir;
/* create list store */
store = gtk_list_store_new (NUM_COLUMNS,
GDK_TYPE_PIXBUF,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
all_dir = fr_get_dir ("all-applications:/");
if (all_dir != NULL) {
files = g_slist_copy (((DirRec *)all_dir)->recs);
} else {
files = NULL;
tmp = entries;
while (tmp != NULL) {
DirRec *dr = tmp->data;
scan_dir_recurse (dr, &files);
tmp = tmp->next;
}
/* Collate */
......@@ -784,61 +782,55 @@ simple_contents_shown (GtkWidget *vbox,
tmp = files;
while (tmp != NULL) {
GtkTreeIter iter;
FileRec *fr;
GdkPixbuf *pixbuf;
GdkPixmap *pixmap;
GdkBitmap *mask;
int row;
char *text[2];
char *icon;
fr = tmp->data;
if (fr->icon != NULL) {
pixbuf = gdk_pixbuf_new_from_file (fr->icon, NULL);
icon = gnome_desktop_item_find_icon (fr->icon,
ICON_SIZE /* desired size */,
0 /* flags */);
if (icon != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
g_free (icon);
} else {
pixbuf = NULL;
}
if (pixbuf != NULL) {
if (pixbuf != NULL &&
(gdk_pixbuf_get_width (pixbuf) != ICON_SIZE ||
gdk_pixbuf_get_height (pixbuf) != ICON_SIZE)) {
GdkPixbuf *scaled;
scaled = gdk_pixbuf_scale_simple (pixbuf, CLIST_ICON_SIZE, CLIST_ICON_SIZE, GDK_INTERP_BILINEAR);
gdk_pixbuf_render_pixmap_and_mask (scaled,
&pixmap, &mask, 128);
scaled = gdk_pixbuf_scale_simple (pixbuf,
ICON_SIZE,
ICON_SIZE,
GDK_INTERP_BILINEAR);
g_object_unref (G_OBJECT (pixbuf));
g_object_unref (G_OBJECT (scaled));
} else {
pixmap = spacer_pixmap;
mask = spacer_mask;
pixbuf = scaled;
}
text[0] = fr->fullname;
text[1] = fr->comment;
row = gtk_clist_append (GTK_CLIST (clist),
text);
gtk_clist_set_pixtext (GTK_CLIST (clist),
row, 0,
fr->fullname,
3,
pixmap, mask);
if (pixbuf) {
if (pixmap)
g_object_unref (G_OBJECT (pixmap));
if (mask)
g_object_unref (G_OBJECT (mask));
}
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COLUMN_ICON, pixbuf,
COLUMN_FULLNAME, fr->fullname,
COLUMN_COMMENT, fr->comment,
COLUMN_NAME, fr->name,
-1);
gtk_clist_set_row_data (GTK_CLIST (clist),
row, fr->name);
if (pixbuf != NULL)
g_object_unref (G_OBJECT (pixbuf));
tmp = tmp->next;
}
g_object_unref (G_OBJECT (spacer_pixmap));
g_object_unref (G_OBJECT (spacer_mask));
g_slist_free (files);
}
gtk_tree_view_set_model (GTK_TREE_VIEW (list),
GTK_TREE_MODEL (store));
add_columns (GTK_TREE_VIEW (list));
}
#define DEFAULT_ICON "nautilus/i-executable.png"
......@@ -874,14 +866,14 @@ unset_selected (GtkWidget *dialog)
GtkWidget *gpixmap;
GtkWidget *desc_label;
GtkWidget *entry;
GtkWidget *clist;
GtkWidget *list;
char *text;
label = g_object_get_data (G_OBJECT (dialog), "label");
gpixmap = g_object_get_data (G_OBJECT (dialog), "pixmap");
desc_label = g_object_get_data (G_OBJECT (dialog), "desc_label");
entry = g_object_get_data (G_OBJECT (dialog), "entry");
clist = g_object_get_data (G_OBJECT (dialog), "dentry_list");
list = g_object_get_data (G_OBJECT (dialog), "dentry_list");
if (entry != NULL) {
text = gtk_editable_get_chars (GTK_EDITABLE (entry),
......@@ -915,17 +907,12 @@ unset_selected (GtkWidget *dialog)
g_object_set_data (G_OBJECT (dialog), "use_list",
GPOINTER_TO_INT (FALSE));
gtk_clist_set_selection_mode (GTK_CLIST (clist),
GTK_SELECTION_SINGLE);
gtk_clist_unselect_all (GTK_CLIST (clist));
gtk_tree_selection_unselect_all
(gtk_tree_view_get_selection (GTK_TREE_VIEW (list)));
}
static void
select_row_handler (GtkCList *clist,
gint row,
gint column,
GdkEvent *event,
selection_changed (GtkTreeSelection *selection,
gpointer data)
{
GtkWidget *label;
......@@ -933,25 +920,27 @@ select_row_handler (GtkCList *clist,
GtkWidget *desc_label;
GtkWidget *dialog = data;
gchar *name;
GtkTreeModel *model;
GtkTreeIter iter;
GValue value = {0, };
if (clist->selection == NULL)
if ( ! gtk_tree_selection_get_selected (selection, &model, &iter))
return;
/* Change selection mode once we have a selection */
gtk_clist_set_selection_mode (GTK_CLIST (clist),
GTK_SELECTION_BROWSE);
gtk_tree_model_get_value (model, &iter,
COLUMN_NAME,
&value);
name = g_strdup (g_value_get_string (&value));
g_value_unset (&value);
label = g_object_get_data (G_OBJECT (dialog), "label");
gpixmap = g_object_get_data (G_OBJECT (dialog), "pixmap");
desc_label = g_object_get_data (G_OBJECT (dialog), "desc_label");
name = gtk_clist_get_row_data (GTK_CLIST (clist),
row);
if (name) {
if (name != NULL) {
QuickDesktopItem *qitem;
qitem = quick_desktop_item_load_file (name /*file */,
qitem = quick_desktop_item_load_uri (name /*file */,
"Application" /* expected type */,
TRUE /* run tryexec */);
if (qitem != NULL) {
......@@ -967,10 +956,11 @@ select_row_handler (GtkCList *clist,
sure_string (qitem->comment));
icon = gnome_desktop_item_find_icon (qitem->icon,
20 /* desired size */,
48 /* desired size */,
0 /* flags */);
if (icon != NULL) {
pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
g_free (icon);
} else {
pixbuf = NULL;
}
......@@ -983,6 +973,8 @@ select_row_handler (GtkCList *clist,
quick_desktop_item_destroy (qitem);
}
g_free (name);
}
sync_list_to_entry (dialog);
......@@ -995,40 +987,29 @@ create_simple_contents (void)
GtkWidget *w;
GtkWidget *label;
GtkWidget *pixmap;
GtkWidget *clist;
GtkWidget *list;
GtkWidget *hbox;
char *titles[2];
GtkTreeSelection *selection;
vbox = gtk_vbox_new (FALSE, 1);
titles[0] = _("Available Programs");
titles[1] = _("Description");
clist = gtk_clist_new_with_titles (1 /* 2 */, titles);
g_object_set_data (G_OBJECT (run_dialog), "dentry_list", clist);
gtk_clist_set_selection_mode (GTK_CLIST (clist),
GTK_SELECTION_SINGLE);
list = gtk_tree_view_new ();
g_object_set_data (G_OBJECT (run_dialog), "dentry_list", list);
gtk_clist_column_titles_passive (GTK_CLIST (clist));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
gtk_widget_ensure_style (clist);
#ifdef FIXME
gtk_clist_set_row_height (GTK_CLIST (clist),
MAX (clist->style->font->ascent +
clist->style->font->descent,
CLIST_ICON_SIZE));
#endif
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (clist),
"select_row",
G_CALLBACK (select_row_handler),
g_signal_connect (G_OBJECT (selection),
"changed",
G_CALLBACK (selection_changed),
run_dialog);
w = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (w),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (w), clist);
gtk_container_add (GTK_CONTAINER (w), list);
gtk_box_pack_start (GTK_BOX (vbox), w,
TRUE, TRUE, GNOME_PAD_SMALL);
......@@ -1068,10 +1049,7 @@ create_simple_contents (void)
vbox,
(GtkDestroyNotify) g_object_unref);
g_signal_connect (G_OBJECT (vbox),
"show",
G_CALLBACK (simple_contents_shown),
run_dialog);
fill_list (list);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (run_dialog)->vbox),
vbox,
......
This diff is collapsed.
......@@ -73,8 +73,7 @@ void make_panel_submenu (GtkWidget *menu,
gboolean fake_submenus,
gboolean is_basep);
GtkWidget * create_panel_root_menu (PanelWidget *panel,
gboolean tearoff);
GtkWidget * create_panel_root_menu (PanelWidget *panel);
void menu_properties (Menu *menu);
......@@ -84,9 +83,6 @@ void panel_lock (GtkWidget *widget,
/*to be called on startup to load in some of the directories*/
void init_menus (void);
void panel_menu_session_save_tornoffs (void);
void panel_menu_session_load_tornoffs (void);
GtkWidget * create_menu_at (GtkWidget *menu,
const char *menudir,
gboolean applets,
......@@ -109,7 +105,6 @@ void setup_internal_applet_drag (GtkWidget *menuitem,
GtkWidget * create_root_menu (GtkWidget *root_menu,
gboolean fake_submenus,
int flags,
gboolean tearoff,
gboolean is_basep,
gboolean run_item);
......@@ -133,8 +128,6 @@ enum {
#define PANEL_MENU_HAVE_ICONS_KEY "/desktop/gnome/menus/show-icons"
gboolean panel_menu_have_icons (void);
#define PANEL_MENU_HAVE_TEAROFF_KEY "/desktop/gnome/interface/menus-have-tearoff"
gboolean panel_menu_have_tearoff (void);
GtkWidget * panel_menu_new (void);
void panel_load_menu_image_deferred (GtkWidget *image_menu_item,
......
#include <string.h>
#include <math.h>
#include <libgnomecanvas/libgnomecanvas.h>
#include "panel-util.h"
#include "rgb-stuff.h"
......@@ -1357,3 +1358,118 @@ start_geginv (void)
gtk_widget_show_all (geginv);
}
static gboolean
move_window_handler (gpointer data)
{
int x, y, sx, sy, wx, wy, foox, fooy;
GtkWidget *win = data;
data = g_object_get_data (G_OBJECT (win), "move_speed_x");
sx = GPOINTER_TO_INT (data);
data = g_object_get_data (G_OBJECT (win), "move_speed_y");
sy = GPOINTER_TO_INT (data);
gdk_window_get_pointer (NULL, &x, &y, NULL);
wx = win->allocation.x;
wy = win->allocation.y;
foox = wx + (win->allocation.width / 2);
fooy = wy + (win->allocation.height / 2);
if (sqrt ((foox - x)*(foox - x) + (fooy - y)*(fooy - y)) <
MAX (win->allocation.width, win->allocation.height)) {
if (foox < x) sx -= 5;
else sx += 5;
if (fooy < y) sy -= 5;
else sy += 5;
} else {
sx /= 2;
sy /= 2;
}
if (sx > 50) sx = 50;
else if (sx < -50) sx = -50;
if (sy > 50) sy = 50;
else if (sy < -50) sy = -50;
wx += sx;
wy += sy;
if (wx < 0) wx = 0;
if (wy < 0) wy = 0;
if (wx + win->allocation.width > gdk_screen_width ())
wx = gdk_screen_width () - win->allocation.width;
if (wy + win->allocation.height > gdk_screen_height ())
wy = gdk_screen_height () - win->allocation.height;
gtk_window_move (GTK_WINDOW (win), wx, wy);
win->allocation.x = wx;
win->allocation.y = wy;
data = GINT_TO_POINTER (sx);
g_object_set_data (G_OBJECT (win), "move_speed_x", data);
data = GINT_TO_POINTER (sy);
g_object_set_data (G_OBJECT (win), "move_speed_y", data);
return TRUE;
}
static void
move_window_destroyed (GtkWidget *win)