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

a new call for checking if an applet is in drag

Thu Apr 30 01:11:24 1998  George Lebl  <jirka@5z.com>

        * gnome-panel.idl,mico-glue.cc: a new call for
          checking if an applet is in drag

        * panel-widget.[ch]: global variable which specifies
          if an applet is being dragged or not

        * panel.c: use grabing functions for drags of corba applets

        * applet-lib.cc: don't keep track of dragged applets,
          and ask panel for that info, this makes corba applets
          erspond to every button2 click

        * panel-widget.c: put eventbox behind the dropzone to
          catch it's button press so we can get a menu
parent 190b89bd
Thu Apr 30 01:11:24 1998 George Lebl <jirka@5z.com>
* gnome-panel.idl,mico-glue.cc: a new call for
checking if an applet is in drag
* panel-widget.[ch]: global variable which specifies
if an applet is being dragged or not
* panel.c: use grabing functions for drags of corba applets
* applet-lib.cc: don't keep track of dragged applets,
and ask panel for that info, this makes corba applets
erspond to every button2 click
* panel-widget.c: put eventbox behind the dropzone to
catch it's button press so we can get a menu
Wed Apr 29 23:07:38 1998 George Lebl <jirka@5z.com>
* drawer.c,panel-widget.[ch]: store position of drawers
......
Thu Apr 30 01:11:24 1998 George Lebl <jirka@5z.com>
* gnome-panel.idl,mico-glue.cc: a new call for
checking if an applet is in drag
* panel-widget.[ch]: global variable which specifies
if an applet is being dragged or not
* panel.c: use grabing functions for drags of corba applets
* applet-lib.cc: don't keep track of dragged applets,
and ask panel for that info, this makes corba applets
erspond to every button2 click
* panel-widget.c: put eventbox behind the dropzone to
catch it's button press so we can get a menu
Wed Apr 29 23:07:38 1998 George Lebl <jirka@5z.com>
* drawer.c,panel-widget.[ch]: store position of drawers
......
......@@ -19,10 +19,6 @@
GNOME::Panel_var panel_client;
/*this might be done better but I doubt there will be more then one
drag at a time :) Blah blah */
static int currently_dragged_id = -1;
static GdkCursor *fleur_cursor=NULL;
typedef struct _CallbackInfo CallbackInfo;
......@@ -196,21 +192,22 @@ gnome_panel_applet_register_callback(int applet_id,
static gint
applet_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
int ourid = (int)data;
int ourid = PTOI(data);
GdkEventButton *bevent;
gint in_drag;
switch (event->type) {
case GDK_BUTTON_PRESS:
bevent = (GdkEventButton *) event;
if(bevent->button == 2 && currently_dragged_id==-1) {
in_drag = panel_client->applet_in_drag(cookie);
/*check to see if there is an applet being dragged*/
if(bevent->button == 2 && !in_drag) {
gdk_pointer_ungrab(GDK_CURRENT_TIME);
gtk_grab_remove(widget);
panel_client->applet_drag_start(cookie,ourid);
currently_dragged_id = ourid;
move_grab_add(widget);
return TRUE;
} else if(currently_dragged_id > -1) {
} else if(in_drag) {
panel_client->applet_drag_stop(cookie,ourid);
currently_dragged_id = -1;
move_grab_remove(widget);
return TRUE;
} else if(bevent->button == 3) {
gdk_pointer_ungrab(GDK_CURRENT_TIME);
......@@ -220,10 +217,8 @@ applet_event(GtkWidget *widget, GdkEvent *event, gpointer data)
}
break;
case GDK_BUTTON_RELEASE:
if(currently_dragged_id > -1) {
if(panel_client->applet_in_drag(cookie)) {
panel_client->applet_drag_stop(cookie, ourid);
currently_dragged_id = -1;
move_grab_remove(widget);
return TRUE;
}
break;
......@@ -283,7 +278,7 @@ bind_top_applet_events(GtkWidget *widget, int applet_id)
gtk_signal_connect(GTK_OBJECT(widget),
"event",
GTK_SIGNAL_FUNC(applet_event),
(gpointer)applet_id);
ITOP(applet_id));
if (GTK_IS_CONTAINER(widget))
gtk_container_foreach (GTK_CONTAINER (widget),
......
......@@ -11,10 +11,13 @@ module GNOME {
out string cfgpath,
out string globcfgpath,
out unsigned long wid);
void applet_register(in string cookie, in string ior, in short applet_id);
void applet_register(in string cookie, in string ior,
in short applet_id);
void applet_abort_id(in string cookie, in short applet_id);
void applet_request_glob_cfg(in string cookie, out string globcfgpath);
void applet_remove_from_panel (in string cookie, in short applet_id);
void applet_request_glob_cfg(in string cookie,
out string globcfgpath);
void applet_remove_from_panel (in string cookie,
in short applet_id);
short applet_get_panel (in string cookie, in short applet_id);
short applet_get_pos (in string cookie, in short applet_id);
void applet_show_menu (in string cookie, in short applet_id);
......@@ -24,8 +27,11 @@ module GNOME {
in short applet_id,
in string callback_name,
in string menuitem_text);
void applet_add_tooltip (in string cookie, in short applet_id, in string tooltip);
void applet_remove_tooltip (in string cookie, in short applet_id);
void applet_add_tooltip (in string cookie, in short applet_id,
in string tooltip);
void applet_remove_tooltip (in string cookie,
in short applet_id);
short applet_in_drag (in string cookie);
void quit(in string cookie);
};
......
......@@ -500,7 +500,7 @@ panel_state_change(GtkWidget *widget,
return TRUE;
}
static gint
static void
applet_move_foreach(gpointer data, gpointer user_data)
{
gint applet_id = PTOI(gtk_object_get_user_data(GTK_OBJECT(data)));
......@@ -513,7 +513,6 @@ applet_move_foreach(gpointer data, gpointer user_data)
applet_move_foreach,
NULL);
}
return TRUE;
}
static gint
......
......@@ -6,6 +6,7 @@
#include "mico-glue.h"
#include "gnome-panel.h"
#include "panel.h"
#include "panel-widget.h"
#include "mico-parse.h"
#include "cookie.h"
......@@ -53,7 +54,8 @@ public:
CHECK_COOKIE ();
::applet_abort_id (applet_id);
}
void applet_request_glob_cfg (const char *ccookie, char *&globcfgpath) {
void applet_request_glob_cfg (const char *ccookie,
char *&globcfgpath) {
char *globcfg=NULL;
CHECK_COOKIE ();
......@@ -64,11 +66,13 @@ public:
} else
globcfgpath = CORBA::string_dup("");
}
CORBA::Short applet_get_panel (const char *ccookie, CORBA::Short applet_id) {
CORBA::Short applet_get_panel (const char *ccookie,
CORBA::Short applet_id) {
CHECK_COOKIE_V (0);
return ::applet_get_panel (applet_id);
}
CORBA::Short applet_get_pos (const char *ccookie, CORBA::Short applet_id) {
CORBA::Short applet_get_pos (const char *ccookie,
CORBA::Short applet_id) {
CHECK_COOKIE_V (0);
return ::applet_get_pos (applet_id);
}
......@@ -84,7 +88,8 @@ public:
CHECK_COOKIE ();
::applet_drag_stop (applet_id);
}
void applet_remove_from_panel (const char *ccookie, CORBA::Short applet_id) {
void applet_remove_from_panel (const char *ccookie,
CORBA::Short applet_id) {
CHECK_COOKIE ();
::applet_remove_from_panel(applet_id);
}
......@@ -97,14 +102,20 @@ public:
(char *)callback_name,
(char *)menuitem_text);
}
void applet_add_tooltip (const char *ccookie, CORBA::Short applet_id, const char *tooltip) {
void applet_add_tooltip (const char *ccookie, CORBA::Short applet_id,
const char *tooltip) {
CHECK_COOKIE ();
::applet_set_tooltip(applet_id,tooltip);
}
void applet_remove_tooltip (const char *ccookie, CORBA::Short applet_id) {
void applet_remove_tooltip (const char *ccookie,
CORBA::Short applet_id) {
CHECK_COOKIE ();
::applet_set_tooltip(applet_id,NULL);
}
CORBA::Short applet_in_drag (const char *ccookie) {
CHECK_COOKIE ();
return panel_applet_in_drag;
}
void quit(const char *ccookie) {
CHECK_COOKIE ();
::panel_quit();
......
......@@ -6,6 +6,10 @@
GList *panels=NULL; /*other panels we might want to move the applet to*/
/*there can universally be only one applet being dragged since we assume
we only have one mouse :) */
gint panel_applet_in_drag = FALSE;
static void panel_widget_class_init (PanelWidgetClass *klass);
static void panel_widget_init (PanelWidget *panel_widget);
......@@ -1651,10 +1655,12 @@ panel_widget_new (gint size,
GTK_SIGNAL_FUNC(panel_show_hide_right),
panel);
} else {
panel->hidebutton_e = gtk_frame_new(NULL);
GtkWidget *frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_widget_show(frame);
panel->hidebutton_e = gtk_event_box_new();
gtk_widget_show(panel->hidebutton_e);
gtk_frame_set_shadow_type(GTK_FRAME(panel->hidebutton_e),
GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(panel->hidebutton_e),frame);
gtk_widget_set_usize(panel->hidebutton_e,40,0);
}
gtk_table_attach(GTK_TABLE(panel->table),panel->hidebutton_e,
......@@ -1672,10 +1678,12 @@ panel_widget_new (gint size,
GTK_SIGNAL_FUNC(panel_show_hide_right),
panel);
} else {
panel->hidebutton_n = gtk_frame_new(NULL);
GtkWidget *frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_widget_show(frame);
panel->hidebutton_n = gtk_event_box_new();
gtk_widget_show(panel->hidebutton_n);
gtk_frame_set_shadow_type(GTK_FRAME(panel->hidebutton_n),
GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(panel->hidebutton_n),frame);
gtk_widget_set_usize(panel->hidebutton_n,0,40);
}
gtk_table_attach(GTK_TABLE(panel->table),panel->hidebutton_n,
......@@ -1693,10 +1701,12 @@ panel_widget_new (gint size,
GTK_SIGNAL_FUNC(panel_show_hide_left),
panel);
} else {
panel->hidebutton_w = gtk_frame_new(NULL);
GtkWidget *frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_widget_show(frame);
panel->hidebutton_w = gtk_event_box_new();
gtk_widget_show(panel->hidebutton_w);
gtk_frame_set_shadow_type(GTK_FRAME(panel->hidebutton_w),
GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(panel->hidebutton_w),frame);
gtk_widget_set_usize(panel->hidebutton_w,40,0);
}
gtk_table_attach(GTK_TABLE(panel->table),panel->hidebutton_w,
......@@ -1714,10 +1724,12 @@ panel_widget_new (gint size,
GTK_SIGNAL_FUNC(panel_show_hide_left),
panel);
} else {
panel->hidebutton_s = gtk_frame_new(NULL);
GtkWidget *frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_widget_show(frame);
panel->hidebutton_s = gtk_event_box_new();
gtk_widget_show(panel->hidebutton_s);
gtk_frame_set_shadow_type(GTK_FRAME(panel->hidebutton_s),
GTK_SHADOW_OUT);
gtk_container_add(GTK_CONTAINER(panel->hidebutton_s),frame);
gtk_widget_set_usize(panel->hidebutton_s,0,40);
}
gtk_table_attach(GTK_TABLE(panel->table),panel->hidebutton_s,
......@@ -1822,6 +1834,7 @@ panel_widget_new (gint size,
void
panel_widget_applet_drag_start_no_grab(PanelWidget *panel, GtkWidget *applet)
{
panel_applet_in_drag = TRUE;
panel->currently_dragged_applet = applet;
panel->currently_dragged_applet_pos =
panel_widget_get_pos(panel,applet);
......@@ -1831,6 +1844,7 @@ void
panel_widget_applet_drag_end_no_grab(PanelWidget *panel)
{
panel->currently_dragged_applet = NULL;
panel_applet_in_drag = FALSE;
}
void
......@@ -1847,7 +1861,7 @@ panel_widget_applet_drag_start(PanelWidget *panel, GtkWidget *applet)
GDK_CURRENT_TIME);
}
static void
void
panel_widget_applet_drag_end(PanelWidget *panel)
{
gdk_pointer_ungrab(GDK_CURRENT_TIME);
......@@ -1979,6 +1993,10 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
new_panel,0);
if(pos<0)
pos = 0;
/*disable reentrancy into this
function*/
panel->currently_dragged_applet_pos =
-999;
if(panel_widget_reparent(panel,
new_panel,
applet,
......
......@@ -182,9 +182,10 @@ void panel_widget_restore_state (PanelWidget *panel);
void panel_widget_open_drawer (PanelWidget *panel);
void panel_widget_close_drawer (PanelWidget *panel);
/*initiate drag*/
/*drag*/
void panel_widget_applet_drag_start (PanelWidget *panel,
GtkWidget *applet);
void panel_widget_applet_drag_end (PanelWidget *panel);
/* needed for corba */
void panel_widget_applet_drag_start_no_grab(PanelWidget *panel,
......@@ -229,6 +230,8 @@ void panel_widget_set_drawer_pos (PanelWidget *panel,
extern GList *panels;
extern gint panel_applet_in_drag;
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -645,7 +645,9 @@ applet_drag_start(gint applet_id)
PANEL_APPLET_PARENT_KEY);
g_return_if_fail(panel!=NULL);
panel_widget_applet_drag_start_no_grab(panel,info->widget);
panel_widget_applet_drag_start(panel,info->widget);
panel_widget_applet_drag_end(panel);
panel_widget_applet_drag_start(panel,info->widget);
panel_widget_applet_move_use_idle(panel);
}
......@@ -661,7 +663,7 @@ applet_drag_stop(gint applet_id)
PANEL_APPLET_PARENT_KEY);
g_return_if_fail(panel!=NULL);
panel_widget_applet_drag_end_no_grab(panel);
panel_widget_applet_drag_end(panel);
}
void
......
......@@ -11,10 +11,13 @@ module GNOME {
out string cfgpath,
out string globcfgpath,
out unsigned long wid);
void applet_register(in string cookie, in string ior, in short applet_id);
void applet_register(in string cookie, in string ior,
in short applet_id);
void applet_abort_id(in string cookie, in short applet_id);
void applet_request_glob_cfg(in string cookie, out string globcfgpath);
void applet_remove_from_panel (in string cookie, in short applet_id);
void applet_request_glob_cfg(in string cookie,
out string globcfgpath);
void applet_remove_from_panel (in string cookie,
in short applet_id);
short applet_get_panel (in string cookie, in short applet_id);
short applet_get_pos (in string cookie, in short applet_id);
void applet_show_menu (in string cookie, in short applet_id);
......@@ -24,8 +27,11 @@ module GNOME {
in short applet_id,
in string callback_name,
in string menuitem_text);
void applet_add_tooltip (in string cookie, in short applet_id, in string tooltip);
void applet_remove_tooltip (in string cookie, in short applet_id);
void applet_add_tooltip (in string cookie, in short applet_id,
in string tooltip);
void applet_remove_tooltip (in string cookie,
in short applet_id);
short applet_in_drag (in string cookie);
void quit(in string cookie);
};
......
......@@ -11,10 +11,13 @@ module GNOME {
out string cfgpath,
out string globcfgpath,
out unsigned long wid);
void applet_register(in string cookie, in string ior, in short applet_id);
void applet_register(in string cookie, in string ior,
in short applet_id);
void applet_abort_id(in string cookie, in short applet_id);
void applet_request_glob_cfg(in string cookie, out string globcfgpath);
void applet_remove_from_panel (in string cookie, in short applet_id);
void applet_request_glob_cfg(in string cookie,
out string globcfgpath);
void applet_remove_from_panel (in string cookie,
in short applet_id);
short applet_get_panel (in string cookie, in short applet_id);
short applet_get_pos (in string cookie, in short applet_id);
void applet_show_menu (in string cookie, in short applet_id);
......@@ -24,8 +27,11 @@ module GNOME {
in short applet_id,
in string callback_name,
in string menuitem_text);
void applet_add_tooltip (in string cookie, in short applet_id, in string tooltip);
void applet_remove_tooltip (in string cookie, in short applet_id);
void applet_add_tooltip (in string cookie, in short applet_id,
in string tooltip);
void applet_remove_tooltip (in string cookie,
in short applet_id);
short applet_in_drag (in string cookie);
void quit(in string cookie);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment