2005-07-13 05:44:22 +00:00
|
|
|
/* testdnd.c
|
|
|
|
* Copyright (C) 1998 Red Hat, Inc.
|
|
|
|
* Author: Owen Taylor
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
1998-10-18 23:28:36 +00:00
|
|
|
#include "gtk/gtk.h"
|
|
|
|
|
|
|
|
/* Target side drag signals */
|
|
|
|
|
|
|
|
/* XPM */
|
2010-08-06 18:33:57 +00:00
|
|
|
static const char * drag_icon_xpm[] = {
|
1998-10-18 23:28:36 +00:00
|
|
|
"36 48 9 1",
|
|
|
|
" c None",
|
|
|
|
". c #020204",
|
|
|
|
"+ c #8F8F90",
|
|
|
|
"@ c #D3D3D2",
|
|
|
|
"# c #AEAEAC",
|
|
|
|
"$ c #ECECEC",
|
|
|
|
"% c #A2A2A4",
|
|
|
|
"& c #FEFEFC",
|
|
|
|
"* c #BEBEBC",
|
|
|
|
" .....................",
|
|
|
|
" ..&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ...&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&.&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&.&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&.&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&.&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&.&&&@&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&.*$%$+$&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&&.%$%$+&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&&&.#&#@$&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&&&&.#$**#$&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&&&&&.&@%&%$&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&&&&&&.&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
" ..&&&&&&&&&&&&.&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
"................&$@&&&@&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&+&&#@%#+@#@*$%$+$&&&&&&&&&&.",
|
|
|
|
".&&&&&&&+&&#@#@&&@*%$%$+&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&+&$%&#@&#@@#&#@$&&&&&&&&&&&.",
|
|
|
|
".&&&&&&@#@@$&*@&@#@#$**#$&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&@%&%$&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&$#@@$&&&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&+&$+&$&@&$@&&$@&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&+&&#@%#+@#@*$%&+$&&&&&&&&.",
|
|
|
|
".&&&&&&&&&+&&#@#@&&@*%$%$+&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&+&$%&#@&#@@#&#@$&&&&&&&&&.",
|
|
|
|
".&&&&&&&&@#@@$&*@&@#@#$#*#$&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&$%&%$&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&$#@@$&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&+&$%&$$@&$@&&$@&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&+&&#@%#+@#@*$%$+$&&&&&&.",
|
|
|
|
".&&&&&&&&&&&+&&#@#@&&@*#$%$+&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&+&$+&*@&#@@#&#@$&&&&&&&.",
|
|
|
|
".&&&&&&&&&&$%@@&&*@&@#@#$#*#&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&$%&%$&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&$#@@$&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&+&$%&$$@&$@&&$@&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&+&&#@%#+@#@*$%$+$&&.",
|
|
|
|
".&&&&&&&&&&&&&&&+&&#@#@&&@*#$%$+&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&+&$+&*@&#@@#&#@$&&&.",
|
|
|
|
".&&&&&&&&&&&&&&$%@@&&*@&@#@#$#*#&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&&&&&$%&%$&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
".&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.",
|
|
|
|
"...................................."};
|
|
|
|
|
|
|
|
/* XPM */
|
2010-08-06 18:33:57 +00:00
|
|
|
static const char * trashcan_closed_xpm[] = {
|
1998-10-18 23:28:36 +00:00
|
|
|
"64 80 17 1",
|
|
|
|
" c None",
|
|
|
|
". c #030304",
|
|
|
|
"+ c #5A5A5C",
|
|
|
|
"@ c #323231",
|
|
|
|
"# c #888888",
|
|
|
|
"$ c #1E1E1F",
|
|
|
|
"% c #767677",
|
|
|
|
"& c #494949",
|
|
|
|
"* c #9E9E9C",
|
|
|
|
"= c #111111",
|
|
|
|
"- c #3C3C3D",
|
|
|
|
"; c #6B6B6B",
|
|
|
|
"> c #949494",
|
|
|
|
", c #282828",
|
|
|
|
"' c #808080",
|
|
|
|
") c #545454",
|
|
|
|
"! c #AEAEAC",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ==......=$$...=== ",
|
|
|
|
" ..$------)+++++++++++++@$$... ",
|
|
|
|
" ..=@@-------&+++++++++++++++++++-.... ",
|
|
|
|
" =.$$@@@-&&)++++)-,$$$$=@@&+++++++++++++,..$ ",
|
|
|
|
" .$$$$@@&+++++++&$$$@@@@-&,$,-++++++++++;;;&.. ",
|
|
|
|
" $$$$,@--&++++++&$$)++++++++-,$&++++++;%%'%%;;$@ ",
|
|
|
|
" .-@@-@-&++++++++-@++++++++++++,-++++++;''%;;;%*-$ ",
|
|
|
|
" +------++++++++++++++++++++++++++++++;;%%%;;##*!. ",
|
|
|
|
" =+----+++++++++++++++++++++++;;;;;;;;;;;;%'>>). ",
|
|
|
|
" .=)&+++++++++++++++++;;;;;;;;;;;;;;%''>>#>#@. ",
|
|
|
|
" =..=&++++++++++++;;;;;;;;;;;;;%###>>###+%== ",
|
|
|
|
" .&....=-+++++%;;####''''''''''##'%%%)..#. ",
|
|
|
|
" .+-++@....=,+%#####'%%%%%%%%%;@$-@-@*++!. ",
|
|
|
|
" .+-++-+++-&-@$$=$=......$,,,@;&)+!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" =+-++-+++-+++++++++!++++!++++!+++!++!+++= ",
|
|
|
|
" $.++-+++-+++++++++!++++!++++!+++!++!+.$ ",
|
|
|
|
" =.++++++++++++++!++++!++++!+++!++.= ",
|
|
|
|
" $..+++++++++++++++!++++++...$ ",
|
|
|
|
" $$=.............=$$ ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" "};
|
|
|
|
|
|
|
|
/* XPM */
|
2010-08-06 18:33:57 +00:00
|
|
|
static const char * trashcan_open_xpm[] = {
|
1998-10-18 23:28:36 +00:00
|
|
|
"64 80 17 1",
|
|
|
|
" c None",
|
|
|
|
". c #030304",
|
|
|
|
"+ c #5A5A5C",
|
|
|
|
"@ c #323231",
|
|
|
|
"# c #888888",
|
|
|
|
"$ c #1E1E1F",
|
|
|
|
"% c #767677",
|
|
|
|
"& c #494949",
|
|
|
|
"* c #9E9E9C",
|
|
|
|
"= c #111111",
|
|
|
|
"- c #3C3C3D",
|
|
|
|
"; c #6B6B6B",
|
|
|
|
"> c #949494",
|
|
|
|
", c #282828",
|
|
|
|
"' c #808080",
|
|
|
|
") c #545454",
|
|
|
|
"! c #AEAEAC",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" .=.==.,@ ",
|
|
|
|
" ==.,@-&&&)-= ",
|
|
|
|
" .$@,&++;;;%>*- ",
|
|
|
|
" $,-+)+++%%;;'#+. ",
|
|
|
|
" =---+++++;%%%;%##@. ",
|
|
|
|
" @)++++++++;%%%%'#%$ ",
|
|
|
|
" $&++++++++++;%%;%##@= ",
|
|
|
|
" ,-++++)+++++++;;;'#%) ",
|
|
|
|
" @+++&&--&)++++;;%'#'-. ",
|
|
|
|
" ,&++-@@,,,,-)++;;;'>'+, ",
|
|
|
|
" =-++&@$@&&&&-&+;;;%##%+@ ",
|
|
|
|
" =,)+)-,@@&+++++;;;;%##%&@ ",
|
|
|
|
" @--&&,,@&)++++++;;;;'#)@ ",
|
|
|
|
" ---&)-,@)+++++++;;;%''+, ",
|
|
|
|
" $--&)+&$-+++++++;;;%%'';- ",
|
|
|
|
" .,-&+++-$&++++++;;;%''%&= ",
|
|
|
|
" $,-&)++)-@++++++;;%''%), ",
|
|
|
|
" =,@&)++++&&+++++;%'''+$@&++++++ ",
|
|
|
|
" .$@-++++++++++++;'#';,........=$@&++++ ",
|
|
|
|
" =$@@&)+++++++++++'##-.................=&++ ",
|
|
|
|
" .$$@-&)+++++++++;%#+$.....................=)+ ",
|
|
|
|
" $$,@-)+++++++++;%;@=........................,+ ",
|
|
|
|
" .$$@@-++++++++)-)@=............................ ",
|
|
|
|
" $,@---)++++&)@===............................,. ",
|
|
|
|
" $-@---&)))-$$=..............................=)!. ",
|
|
|
|
" --&-&&,,$=,==...........................=&+++!. ",
|
|
|
|
" =,=$..=$+)+++++&@$=.............=$@&+++++!++!. ",
|
|
|
|
" .)-++-+++++++++++++++++++++++++++!++!++!. ",
|
|
|
|
" .+-++-+++++++++++++++++++++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!+++!!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" .+-++-+++-+++++++++!++++!++++!+++!++!++!. ",
|
|
|
|
" =+-++-+++-+++++++++!++++!++++!+++!++!+++= ",
|
|
|
|
" $.++-+++-+++++++++!++++!++++!+++!++!+.$ ",
|
|
|
|
" =.++++++++++++++!++++!++++!+++!++.= ",
|
|
|
|
" $..+++++++++++++++!++++++...$ ",
|
|
|
|
" $$==...........==$$ ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" "};
|
|
|
|
|
2010-08-06 18:33:57 +00:00
|
|
|
GdkPixbuf *trashcan_open;
|
|
|
|
GdkPixbuf *trashcan_closed;
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
gboolean have_drag;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TARGET_STRING,
|
|
|
|
TARGET_ROOTWIN
|
|
|
|
};
|
|
|
|
|
|
|
|
static GtkTargetEntry target_table[] = {
|
|
|
|
{ "STRING", 0, TARGET_STRING },
|
|
|
|
{ "text/plain", 0, TARGET_STRING },
|
2003-06-09 02:13:42 +00:00
|
|
|
{ "application/x-rootwindow-drop", 0, TARGET_ROOTWIN }
|
1998-10-18 23:28:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static guint n_targets = sizeof(target_table) / sizeof(target_table[0]);
|
|
|
|
|
|
|
|
void
|
|
|
|
target_drag_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
g_print("leave\n");
|
|
|
|
have_drag = FALSE;
|
2010-08-06 18:33:57 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (widget), trashcan_closed);
|
1998-10-18 23:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
target_drag_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
1998-11-27 17:16:36 +00:00
|
|
|
GtkWidget *source_widget;
|
2001-03-15 23:21:39 +00:00
|
|
|
GList *tmp_list;
|
1998-11-27 17:16:36 +00:00
|
|
|
|
1998-10-18 23:28:36 +00:00
|
|
|
if (!have_drag)
|
|
|
|
{
|
|
|
|
have_drag = TRUE;
|
2010-08-06 18:33:57 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (widget), trashcan_open);
|
1998-10-18 23:28:36 +00:00
|
|
|
}
|
1998-11-27 17:16:36 +00:00
|
|
|
|
|
|
|
source_widget = gtk_drag_get_source_widget (context);
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
g_print ("motion, source %s\n", source_widget ?
|
2010-01-04 06:49:26 +00:00
|
|
|
G_OBJECT_TYPE_NAME (source_widget) :
|
documented necessary changes for 1.4 transition.
Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org>
* docs/Changes-1.4.txt: documented necessary changes for 1.4 transition.
* gtk/gtktext.c: made the adjustments no-construct args, simply
provide default adjustments.
(gtk_text_destroy): release adjustments.
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the
adjustment argument non-construct.
* gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here,
instead of in finalize.
(gtk_progress_get_text_from_value):
(gtk_progress_get_current_text):
(gtk_progress_set_value):
(gtk_progress_get_percentage_from_value):
(gtk_progress_get_current_percentage):
(gtk_progress_set_percentage):
(gtk_progress_configure): ensure an adjustment is present.
Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcolorsel.[hc]:
* gtk/gtkcolorseldialog.[hc]:
* gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain
their parent implementation, use bit fields for boolean values, don't
create unused widgets, usage of glib types, braces go on their own
lines, function argument alignment, #include directives etc. etc. etc..
* gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h.
Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org>
* gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips.
* gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state
of NULL.
* gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references
to freed data.
(gtk_combo_destroy): don't keep a pointer to a destroyed window.
* gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer
to NULL when the toplevel is getting destroyed.
(gtk_menu_set_tearoff_state): same here for the tearoff_window.
(gtk_menu_destroy):
(gtk_menu_init): store the information of whether we have to
readd the initial child ref_count during destruction in a new
GtkMenu field needs_destruction_ref_count.
* gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it
here, those reading: learn from my mistake! ;)
in order for set_?adjustment to support a default adjustemnt if
invoked with an adjustment pointer of NULL, the code read (pseudo):
if (v->adjustment) unref (v->adjustment);
if (!adjustment) adjustment = adjustment_new ();
if (v->adjustment != adjustment) v->adjustment = ref (adjustment);
now imagine the first unref to actually free the old adjustment and
adjustment_new() creating a new adjustment from the very same memory
portion. here, the latter comparision will unintendedly fail, and
all hell breaks loose.
(gtk_viewport_set_hadjustment):
(gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL
after unreferencing it.
* gtk/gtkcontainer.[hc]: removed toplevel registration
functions: gtk_container_register_toplevel(),
gtk_container_unregister_toplevel() and
gtk_container_get_toplevels() which had wrong semantics
anyways: it didn't reference and copy the list.
* gtk/gtkwindow.c: we take over the container toplevel registration
bussiness now. windows are registered across multiple destructions,
untill they are finalized. the initial implicit reference count
users are holding on windows is removed with the first destruction
though.
(gtk_window_init): ref & sink and set has_user_ref_count, got
rid of gtk_container_register_toplevel() call. add window to
toplevel_list.
(gtk_window_destroy): unref the window if has_user_ref_count
is still set, got rid of call to
gtk_container_unregister_toplevel().
(gtk_window_finalize): remove window from toplevel list.
(gtk_window_list_toplevels): new function to return a newly
created list with referenced toplevels.
(gtk_window_read_rcfiles): use gtk_window_list_toplevels().
* gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange
adjustment a non-construct arg.
* gtk/gtkvscale.c (gtk_vscale_class_init): likewise.
* gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise.
* gtk/gtkrange.c: added some realized checks.
(gtk_range_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize. remove timer.
(gtk_range_get_adjustment): demand create adjustment.
* gtk/gtkviewport.c: made h/v adjustment non-construct args.
we simply create them on demand now and get rid of them in
the destroy handler.
(gtk_viewport_destroy): get rid of the h/v adjustments in the
destroy handler instead of finalize.
(gtk_viewport_get_hadjustment):
(gtk_viewport_get_vadjustment):
(gtk_viewport_size_allocate): demand create h/v adjustment
if required.
* gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the
gtk_widget_real_destroy () functionality.
(gtk_widget_real_destroy): reinitialize with a new style, instead
of setting widget->style to NULL.
Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org>
* gtk/gtkcalendar.c:
* gtk/gtkbutton.c: ported _get_type() implementation over to
GType, either to preserve memchunks allocation facilities,
or because Gtk+ 1.0 GtkTypeInfo was still being used.
* gtk/gtkobject.[hc]: derive from GObject. ported various functions
over. prepare for ::destroy to be emitted multiple times.
removed reference tracer magic. chain into GObjectClass.shutdown()
to emit ::destroy signal.
* gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being
fundamental.
* gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init()
cludge.
* gtk/gtksocket.c:
* gtk/gtkplug.c:
* gtk/gtklayout.c:
* gtk/gtklabel.c:
* gtk/gtkargcollector.c:
* gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT
not being a fundamental anymore, and to work with the new
type system (nuked fundamental type varargs clutter).
* gtk/*.c: install finalize handlers in the GObjectClass
part of the class structure.
changed direct GTK_OBJECT()->klass accesses to
GTK_*_GET_CLASS().
changed direct object_class->type accesses to GTK_CLASS_TYPE().
* gtktypeutils.[hc]: use the reserved fundamental ids provided by
GType. made most of the GTK_*() type macros and Gtk* typedefs
simple wrappers around macros and types provided by GType.
most notably, a significant portion of the old API vanished:
GTK_TYPE_MAKE(),
GTK_TYPE_SEQNO(),
GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST,
GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST,
GTK_TYPE_ARGS,
GTK_TYPE_CALLBACK,
GTK_TYPE_C_CALLBACK,
GTK_TYPE_FOREIGN,
GtkTypeQuery,
gtk_type_query(),
gtk_type_set_varargs_type(),
gtk_type_get_varargs_type(),
gtk_type_check_object_cast(),
gtk_type_check_class_cast(),
gtk_type_describe_tree(),
gtk_type_describe_heritage(),
gtk_type_free(),
gtk_type_children_types(),
gtk_type_set_chunk_alloc(),
gtk_type_register_enum(),
gtk_type_register_flags(),
gtk_type_parent_class().
replacements, where available are described in ../docs/Changes-1.4.txt.
implemented compatibility functions for the remaining API.
* configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
|
|
|
"NULL");
|
1998-11-27 17:16:36 +00:00
|
|
|
|
2001-03-15 23:21:39 +00:00
|
|
|
tmp_list = context->targets;
|
|
|
|
while (tmp_list)
|
|
|
|
{
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
char *name = gdk_atom_name (GDK_POINTER_TO_ATOM (tmp_list->data));
|
2001-03-15 23:21:39 +00:00
|
|
|
g_print ("%s\n", name);
|
|
|
|
g_free (name);
|
|
|
|
|
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
}
|
|
|
|
|
1998-10-18 23:28:36 +00:00
|
|
|
gdk_drag_status (context, context->suggested_action, time);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
target_drag_drop (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
g_print("drop\n");
|
|
|
|
have_drag = FALSE;
|
|
|
|
|
2010-08-06 18:33:57 +00:00
|
|
|
gtk_image_set_from_pixbuf (GTK_IMAGE (widget), trashcan_closed);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
if (context->targets)
|
1999-01-23 20:32:20 +00:00
|
|
|
{
|
|
|
|
gtk_drag_get_data (widget, context,
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
GDK_POINTER_TO_ATOM (context->targets->data),
|
1999-01-23 20:32:20 +00:00
|
|
|
time);
|
|
|
|
return TRUE;
|
|
|
|
}
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
target_drag_data_received (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
2010-12-15 23:47:45 +00:00
|
|
|
GtkSelectionData *selection_data,
|
1998-10-18 23:28:36 +00:00
|
|
|
guint info,
|
|
|
|
guint time)
|
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
if (gtk_selection_data_get_length (selection_data) >= 0 &&
|
|
|
|
gtk_selection_data_get_format (selection_data) == 8)
|
1998-10-18 23:28:36 +00:00
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
g_print ("Received \"%s\" in trashcan\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
1998-10-18 23:28:36 +00:00
|
|
|
gtk_drag_finish (context, TRUE, FALSE, time);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_drag_finish (context, FALSE, FALSE, time);
|
|
|
|
}
|
|
|
|
|
1999-01-12 23:27:30 +00:00
|
|
|
void
|
|
|
|
label_drag_data_received (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
2010-12-15 23:47:45 +00:00
|
|
|
GtkSelectionData *selection_data,
|
1999-01-12 23:27:30 +00:00
|
|
|
guint info,
|
|
|
|
guint time)
|
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
if (gtk_selection_data_get_length (selection_data) >= 0 &&
|
|
|
|
gtk_selection_data_get_format (selection_data) == 8)
|
1999-01-12 23:27:30 +00:00
|
|
|
{
|
2010-12-15 23:47:45 +00:00
|
|
|
g_print ("Received \"%s\" in label\n", (gchar *) gtk_selection_data_get_data (selection_data));
|
1999-01-12 23:27:30 +00:00
|
|
|
gtk_drag_finish (context, TRUE, FALSE, time);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_drag_finish (context, FALSE, FALSE, time);
|
|
|
|
}
|
|
|
|
|
1998-10-18 23:28:36 +00:00
|
|
|
void
|
|
|
|
source_drag_data_get (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
if (info == TARGET_ROOTWIN)
|
|
|
|
g_print ("I was dropped on the rootwin\n");
|
|
|
|
else
|
|
|
|
gtk_selection_data_set (selection_data,
|
2010-12-15 23:47:45 +00:00
|
|
|
gtk_selection_data_get_target (selection_data),
|
2008-01-14 14:34:07 +00:00
|
|
|
8, (guchar *) "I'm Data!", 9);
|
1998-10-18 23:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The following is a rather elaborate example demonstrating/testing
|
2008-12-13 05:20:10 +00:00
|
|
|
* changing of the window hierarchy during a drag - in this case,
|
1998-10-18 23:28:36 +00:00
|
|
|
* via a "spring-loaded" popup window.
|
|
|
|
*/
|
|
|
|
static GtkWidget *popup_window = NULL;
|
|
|
|
|
|
|
|
static gboolean popped_up = FALSE;
|
|
|
|
static gboolean in_popup = FALSE;
|
|
|
|
static guint popdown_timer = 0;
|
|
|
|
static guint popup_timer = 0;
|
|
|
|
|
|
|
|
gint
|
|
|
|
popdown_cb (gpointer data)
|
|
|
|
{
|
|
|
|
popdown_timer = 0;
|
|
|
|
|
|
|
|
gtk_widget_hide (popup_window);
|
|
|
|
popped_up = FALSE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
popup_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
if (!in_popup)
|
|
|
|
{
|
|
|
|
in_popup = TRUE;
|
|
|
|
if (popdown_timer)
|
|
|
|
{
|
|
|
|
g_print ("removed popdown\n");
|
2003-02-19 19:42:04 +00:00
|
|
|
g_source_remove (popdown_timer);
|
1998-10-18 23:28:36 +00:00
|
|
|
popdown_timer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
popup_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
if (in_popup)
|
|
|
|
{
|
|
|
|
in_popup = FALSE;
|
|
|
|
if (!popdown_timer)
|
|
|
|
{
|
|
|
|
g_print ("added popdown\n");
|
2006-12-22 19:10:43 +00:00
|
|
|
popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-22 19:10:43 +00:00
|
|
|
gboolean
|
1998-10-18 23:28:36 +00:00
|
|
|
popup_cb (gpointer data)
|
|
|
|
{
|
|
|
|
if (!popped_up)
|
|
|
|
{
|
|
|
|
if (!popup_window)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *table;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
popup_window = gtk_window_new (GTK_WINDOW_POPUP);
|
1998-11-28 07:42:37 +00:00
|
|
|
gtk_window_set_position (GTK_WINDOW (popup_window), GTK_WIN_POS_MOUSE);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
table = gtk_table_new (3,3, FALSE);
|
|
|
|
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
for (j=0; j<3; j++)
|
|
|
|
{
|
|
|
|
char buffer[128];
|
1998-12-10 06:18:32 +00:00
|
|
|
g_snprintf(buffer, sizeof(buffer), "%d,%d", i, j);
|
1998-10-18 23:28:36 +00:00
|
|
|
button = gtk_button_new_with_label (buffer);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), button, i, i+1, j, j+1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
|
|
|
|
gtk_drag_dest_set (button,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
|
|
|
target_table, n_targets - 1, /* no rootwin */
|
|
|
|
GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (button, "drag_motion",
|
|
|
|
G_CALLBACK (popup_motion), NULL);
|
|
|
|
g_signal_connect (button, "drag_leave",
|
|
|
|
G_CALLBACK (popup_leave), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_show_all (table);
|
|
|
|
gtk_container_add (GTK_CONTAINER (popup_window), table);
|
|
|
|
|
|
|
|
}
|
|
|
|
gtk_widget_show (popup_window);
|
|
|
|
popped_up = TRUE;
|
|
|
|
}
|
|
|
|
|
2006-12-22 19:10:43 +00:00
|
|
|
popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
g_print ("added popdown\n");
|
|
|
|
|
|
|
|
popup_timer = FALSE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
popsite_motion (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
if (!popup_timer)
|
2006-12-22 19:10:43 +00:00
|
|
|
popup_timer = gdk_threads_add_timeout (500, popup_cb, NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
popsite_leave (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
if (popup_timer)
|
|
|
|
{
|
2003-02-19 19:42:04 +00:00
|
|
|
g_source_remove (popup_timer);
|
1998-10-18 23:28:36 +00:00
|
|
|
popup_timer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
source_drag_data_delete (GtkWidget *widget,
|
|
|
|
GdkDragContext *context,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_print ("Delete the data!\n");
|
|
|
|
}
|
|
|
|
|
2001-04-25 16:17:46 +00:00
|
|
|
void
|
2004-10-28 15:00:05 +00:00
|
|
|
test_init (void)
|
2001-04-25 16:17:46 +00:00
|
|
|
{
|
2002-03-03 04:16:30 +00:00
|
|
|
if (g_file_test ("../gdk-pixbuf/libpixbufloader-pnm.la",
|
2001-04-25 16:17:46 +00:00
|
|
|
G_FILE_TEST_EXISTS))
|
|
|
|
{
|
2010-05-18 23:23:06 +00:00
|
|
|
g_setenv ("GDK_PIXBUF_MODULE_FILE", "../gdk-pixbuf/loaders.cache", TRUE);
|
|
|
|
g_setenv ("GTK_IM_MODULE_FILE", "../modules/input/immodules.cache", TRUE);
|
2001-04-25 16:17:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-10-18 23:28:36 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *table;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkWidget *pixmap;
|
|
|
|
GtkWidget *button;
|
2010-08-06 18:33:57 +00:00
|
|
|
GdkPixbuf *drag_icon;
|
1998-10-18 23:28:36 +00:00
|
|
|
|
2001-04-25 16:17:46 +00:00
|
|
|
test_init ();
|
|
|
|
|
1998-10-18 23:28:36 +00:00
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (window, "destroy",
|
|
|
|
G_CALLBACK (gtk_main_quit), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
table = gtk_table_new (2, 2, FALSE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), table);
|
|
|
|
|
2010-08-06 18:33:57 +00:00
|
|
|
drag_icon = gdk_pixbuf_new_from_xpm_data (drag_icon_xpm);
|
|
|
|
trashcan_open = gdk_pixbuf_new_from_xpm_data (trashcan_open_xpm);
|
|
|
|
trashcan_closed = gdk_pixbuf_new_from_xpm_data (trashcan_closed_xpm);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
label = gtk_label_new ("Drop Here\n");
|
|
|
|
|
|
|
|
gtk_drag_dest_set (label,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
|
|
|
target_table, n_targets - 1, /* no rootwin */
|
|
|
|
GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (label, "drag_data_received",
|
|
|
|
G_CALLBACK( label_drag_data_received), NULL);
|
1999-01-12 23:27:30 +00:00
|
|
|
|
1998-10-18 23:28:36 +00:00
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Popup\n");
|
|
|
|
|
|
|
|
gtk_drag_dest_set (label,
|
|
|
|
GTK_DEST_DEFAULT_ALL,
|
|
|
|
target_table, n_targets - 1, /* no rootwin */
|
|
|
|
GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (label, "drag_motion",
|
|
|
|
G_CALLBACK (popsite_motion), NULL);
|
|
|
|
g_signal_connect (label, "drag_leave",
|
|
|
|
G_CALLBACK (popsite_leave), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
2010-08-06 18:33:57 +00:00
|
|
|
pixmap = gtk_image_new_from_pixbuf (trashcan_closed);
|
1998-10-18 23:28:36 +00:00
|
|
|
gtk_drag_dest_set (pixmap, 0, NULL, 0, 0);
|
|
|
|
gtk_table_attach (GTK_TABLE (table), pixmap, 1, 2, 0, 1,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (pixmap, "drag_leave",
|
|
|
|
G_CALLBACK (target_drag_leave), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (pixmap, "drag_motion",
|
|
|
|
G_CALLBACK (target_drag_motion), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (pixmap, "drag_drop",
|
|
|
|
G_CALLBACK (target_drag_drop), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (pixmap, "drag_data_received",
|
|
|
|
G_CALLBACK (target_drag_data_received), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
/* Drag site */
|
|
|
|
|
|
|
|
button = gtk_button_new_with_label ("Drag Here\n");
|
|
|
|
|
|
|
|
gtk_drag_source_set (button, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
|
|
|
|
target_table, n_targets,
|
|
|
|
GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
2010-08-06 18:33:57 +00:00
|
|
|
gtk_drag_source_set_icon_pixbuf (button, drag_icon);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_object_unref (drag_icon);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
gtk_table_attach (GTK_TABLE (table), button, 0, 1, 1, 2,
|
|
|
|
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
|
|
|
0, 0);
|
|
|
|
|
2002-10-13 23:22:33 +00:00
|
|
|
g_signal_connect (button, "drag_data_get",
|
|
|
|
G_CALLBACK (source_drag_data_get), NULL);
|
|
|
|
g_signal_connect (button, "drag_data_delete",
|
|
|
|
G_CALLBACK (source_drag_data_delete), NULL);
|
1998-10-18 23:28:36 +00:00
|
|
|
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|