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

removed support for no_window clicking since it's not needed

Fri Aug 28 01:10:47 1998  George Lebl  <jirka@5z.com>

        * panel-widget.[ch]: removed support for no_window clicking since
          it's not needed

        * button-widget.[ch]: added support for "depth" pressing, added an
          inputonly xwindow, and other minor improvements, including a button
          like behaviour

        * menu.c: adapt to the new pressed semantics for button-widget
parent fd65595d
Fri Aug 28 01:10:47 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch]: removed support for no_window clicking since
it's not needed
* button-widget.[ch]: added support for "depth" pressing, added an
inputonly xwindow, and other minor improvements, including a button
like behaviour
* menu.c: adapt to the new pressed semantics for button-widget
Thu Aug 27 02:33:44 1998 George Lebl <jirka@5z.com>
* button-widget.c: fixes, made pressed return bool
......
Fri Aug 28 01:10:47 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch]: removed support for no_window clicking since
it's not needed
* button-widget.[ch]: added support for "depth" pressing, added an
inputonly xwindow, and other minor improvements, including a button
like behaviour
* menu.c: adapt to the new pressed semantics for button-widget
Thu Aug 27 02:33:44 1998 George Lebl <jirka@5z.com>
* button-widget.c: fixes, made pressed return bool
......
......@@ -11,17 +11,22 @@
static void button_widget_class_init (ButtonWidgetClass *klass);
static void button_widget_init (ButtonWidget *button);
static int button_widget_expose (GtkWidget *widget,
GdkEventExpose *event);
static void button_widget_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void button_widget_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static int button_widget_pressed (ButtonWidget *button);
static void button_widget_realize (GtkWidget *widget);
static int button_widget_button_press (GtkWidget *widget,
GdkEventButton *event);
static int button_widget_button_release(GtkWidget *widget,
GdkEventButton *event);
static int button_widget_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static int button_widget_leave_notify (GtkWidget *widget,
GdkEventCrossing *event);
static void button_widget_pressed (ButtonWidget *button);
static void button_widget_unpressed (ButtonWidget *button);
typedef int (*IntSignal) (GtkObject * object,
gpointer data);
typedef void (*VoidSignal) (GtkObject * object,
gpointer data);
......@@ -33,6 +38,8 @@ static GdkPixmap *tiles_up[MAX_TILES]={NULL,NULL,NULL,NULL};
static GdkBitmap *tiles_up_mask[MAX_TILES]={NULL,NULL,NULL,NULL};
static GdkPixmap *tiles_down[MAX_TILES]={NULL,NULL,NULL,NULL};
static GdkBitmap *tiles_down_mask[MAX_TILES]={NULL,NULL,NULL,NULL};
static int tile_border[MAX_TILES]={0,0,0,0};
static int tile_depth[MAX_TILES]={0,0,0,0};
/*are tiles enabled*/
static int tiles_enabled = FALSE;
......@@ -71,22 +78,6 @@ enum {
static int button_widget_signals[LAST_SIGNAL] = {0};
static void
marshal_signal_int (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
IntSignal rfunc;
int *retval;
rfunc = (IntSignal) func;
retval = GTK_RETLOC_BOOL(args[0]);
*retval = (*rfunc) (object, func_data);
}
static void
marshal_signal_void (GtkObject * object,
GtkSignalFunc func,
......@@ -100,6 +91,7 @@ marshal_signal_void (GtkObject * object,
(*rfunc) (object, func_data);
}
static void
button_widget_class_init (ButtonWidgetClass *class)
{
......@@ -123,8 +115,8 @@ button_widget_class_init (ButtonWidgetClass *class)
object_class->type,
GTK_SIGNAL_OFFSET(ButtonWidgetClass,
pressed),
marshal_signal_int,
GTK_TYPE_BOOL,
marshal_signal_void,
GTK_TYPE_NONE,
0);
button_widget_signals[UNPRESSED_SIGNAL] =
gtk_signal_new("unpressed",
......@@ -139,11 +131,48 @@ button_widget_class_init (ButtonWidgetClass *class)
LAST_SIGNAL);
class->clicked = NULL;
class->pressed = NULL; /*FIXME:button_widget_pressed;*/
class->pressed = button_widget_pressed;
class->unpressed = button_widget_unpressed;
widget_class->realize = button_widget_realize;
widget_class->size_allocate = button_widget_size_allocate;
widget_class->size_request = button_widget_size_request;
widget_class->button_press_event = button_widget_button_press;
widget_class->button_release_event = button_widget_button_release;
widget_class->enter_notify_event = button_widget_enter_notify;
widget_class->leave_notify_event = button_widget_leave_notify;
}
static void
button_widget_realize(GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
g_return_if_fail (widget != NULL);
g_return_if_fail (IS_BUTTON_WIDGET (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_KEY_PRESS_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, widget);
}
......@@ -207,28 +236,35 @@ void
button_widget_draw(ButtonWidget *button, GdkPixmap *pixmap)
{
GtkWidget *widget = GTK_WIDGET(button);
GtkWidget *pwidget;
GdkPixmap *tile;
GdkBitmap *tile_mask;
GdkGCValues values;
GdkPoint points[3];
GdkGC *gc;
/*offset for pressed buttons*/
int off = button->in_button&&button->pressed?tile_depth[button->tile]:0;
/*border to not draw when drawing a tile*/
int border = tiles_enabled?tile_border[button->tile]:0;
if(!GTK_WIDGET_REALIZED(button))
return;
pwidget = widget->parent;
gc = gdk_gc_new(pixmap);
if(button->arrow) {
int i;
draw_arrow(points,button->orient);
for(i=0;i<3;i++) {
points[i].x+=widget->allocation.x;
points[i].y+=widget->allocation.y;
points[i].x+=widget->allocation.x+off;
points[i].y+=widget->allocation.y+off;
}
}
if(tiles_enabled) {
if(button->pressed) {
if(button->pressed && button->in_button) {
tile = tiles_down[button->tile];
tile_mask = tiles_down_mask[button->tile];
} else {
......@@ -254,24 +290,30 @@ button_widget_draw(ButtonWidget *button, GdkPixmap *pixmap)
if (button->mask) {
gdk_gc_set_clip_mask (gc, button->mask);
gdk_gc_set_clip_origin (gc, widget->allocation.x,
widget->allocation.y);
gdk_gc_set_clip_origin (gc, widget->allocation.x+off,
widget->allocation.y+off);
}
gdk_draw_pixmap (pixmap, gc, button->pixmap, 0, 0,
widget->allocation.x, widget->allocation.y,
BIG_ICON_SIZE, BIG_ICON_SIZE);
gdk_draw_pixmap (pixmap, gc, button->pixmap, border, border,
widget->allocation.x+off+border,
widget->allocation.y+off+border,
BIG_ICON_SIZE-off-(border*2),
BIG_ICON_SIZE-off-(border*2));
#if 0
/*stripe a pressed button if we have no tiles, to provide some sort of
feedback*/
if(!tiles_enabled && button->pressed) {
if(!tiles_enabled && button->pressed && button->in_button) {
int i;
gdk_gc_set_foreground(gc,&widget->style->black);
gdk_gc_set_foreground(gc,&pwidget->style->black);
for(i=0;i<BIG_ICON_SIZE;i+=2)
gdk_draw_line(pixmap,gc,
widget->allocation.x,widget->allocation.y+i,
widget->allocation.x+BIG_ICON_SIZE,widget->allocation.y+i);
widget->allocation.x,
widget->allocation.y+i,
widget->allocation.x+BIG_ICON_SIZE,
widget->allocation.y+i);
}
#endif
if (button->mask) {
gdk_gc_set_clip_mask (gc, NULL);
......@@ -279,9 +321,9 @@ button_widget_draw(ButtonWidget *button, GdkPixmap *pixmap)
}
if(button->arrow) {
gdk_gc_set_foreground(gc,&widget->style->white);
gdk_gc_set_foreground(gc,&pwidget->style->white);
gdk_draw_polygon(pixmap,gc,TRUE,points,3);
gdk_gc_set_foreground(gc,&widget->style->black);
gdk_gc_set_foreground(gc,&pwidget->style->black);
gdk_draw_polygon(pixmap,gc,FALSE,points,3);
}
......@@ -297,13 +339,17 @@ static void
button_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
}
static void
button_widget_init (ButtonWidget *button)
{
GTK_WIDGET_SET_FLAGS (button, GTK_NO_WINDOW);
buttons = g_list_prepend(buttons,button);
button->pixmap = NULL;
......@@ -314,12 +360,93 @@ button_widget_init (ButtonWidget *button)
button->orient = ORIENT_UP;
button->pressed = FALSE;
button->in_button = FALSE;
button->ignore_leave = FALSE;
gtk_signal_connect(GTK_OBJECT(button),"destroy",
GTK_SIGNAL_FUNC(button_widget_destroy),
NULL);
}
static int
button_widget_button_press (GtkWidget *widget, GdkEventButton *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (IS_BUTTON_WIDGET (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->button == 1) {
ButtonWidget *button = BUTTON_WIDGET (widget);
gtk_grab_add(widget);
button_widget_down (button);
}
return TRUE;
}
static int
button_widget_button_release (GtkWidget *widget, GdkEventButton *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (IS_BUTTON_WIDGET (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (event->button == 1) {
ButtonWidget *button = BUTTON_WIDGET (widget);
gtk_grab_remove (widget);
button_widget_up (button);
}
return TRUE;
}
static int
button_widget_enter_notify (GtkWidget *widget, GdkEventCrossing *event)
{
GtkWidget *event_widget;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (IS_BUTTON_WIDGET (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
event_widget = gtk_get_event_widget ((GdkEvent*) event);
if ((event_widget == widget) &&
(event->detail != GDK_NOTIFY_INFERIOR)) {
ButtonWidget *button = BUTTON_WIDGET (widget);
button->in_button = TRUE;
panel_widget_draw_icon(PANEL_WIDGET(widget->parent),
button);
}
return FALSE;
}
static int
button_widget_leave_notify (GtkWidget *widget, GdkEventCrossing *event)
{
GtkWidget *event_widget;
ButtonWidget *button;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (IS_BUTTON_WIDGET (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
event_widget = gtk_get_event_widget ((GdkEvent*) event);
button = BUTTON_WIDGET (widget);
if ((event_widget == widget) &&
(event->detail != GDK_NOTIFY_INFERIOR) &&
(!button->ignore_leave)) {
button->in_button = FALSE;
panel_widget_draw_icon(PANEL_WIDGET(widget->parent),
button);
}
return FALSE;
}
void
button_widget_clicked(ButtonWidget *button)
{
......@@ -327,13 +454,12 @@ button_widget_clicked(ButtonWidget *button)
button_widget_signals[CLICKED_SIGNAL]);
}
static int
static void
button_widget_pressed(ButtonWidget *button)
{
button->pressed = TRUE;
panel_widget_draw_icon(PANEL_WIDGET(GTK_WIDGET(button)->parent),
button);
return FALSE;
}
static void
button_widget_unpressed(ButtonWidget *button)
......@@ -341,21 +467,15 @@ button_widget_unpressed(ButtonWidget *button)
button->pressed = FALSE;
panel_widget_draw_icon(PANEL_WIDGET(GTK_WIDGET(button)->parent),
button);
if(button->in_button)
button_widget_clicked(button);
}
int
void
button_widget_down(ButtonWidget *button)
{
int retval=FALSE;
/*FIXME:*/
button_widget_pressed(button);
gtk_signal_emit(GTK_OBJECT(button),
button_widget_signals[PRESSED_SIGNAL],
&retval);
printf ("retval: %d\n",retval);
return retval;
button_widget_signals[PRESSED_SIGNAL]);
}
void
button_widget_up(ButtonWidget *button)
......@@ -368,8 +488,8 @@ button_widget_up(ButtonWidget *button)
GtkWidget*
button_widget_new(GdkPixmap *pixmap,
GdkBitmap *mask,
int tile,
int arrow,
guint tile,
guint arrow,
PanelOrientType orient)
{
ButtonWidget *button;
......@@ -415,8 +535,8 @@ loadup_file(GdkPixmap **pixmap, GdkBitmap **mask, char *file)
GtkWidget*
button_widget_new_from_file(char *pixmap,
int tile,
int arrow,
guint tile,
guint arrow,
PanelOrientType orient)
{
GdkPixmap *_pixmap;
......@@ -462,8 +582,8 @@ button_widget_set_pixmap_from_file(ButtonWidget *button, char *pixmap)
void
button_widget_set_params(ButtonWidget *button,
int tile,
int arrow,
guint tile,
guint arrow,
PanelOrientType orient)
{
button->tile = tile;
......@@ -475,7 +595,8 @@ button_widget_set_params(ButtonWidget *button,
}
void
button_widget_load_tile(int tile, char *tile_up, char *tile_down)
button_widget_load_tile(int tile, char *tile_up, char *tile_down,
int border, int depth)
{
GList *list;
......@@ -496,6 +617,9 @@ button_widget_load_tile(int tile, char *tile_up, char *tile_down)
loadup_file(&tiles_up[tile],&tiles_up_mask[tile],tile_up);
loadup_file(&tiles_down[tile],&tiles_down_mask[tile],tile_down);
tile_border[tile] = border;
tile_depth[tile] = depth;
for(list = buttons;list!=NULL;list=g_list_next(list)) {
ButtonWidget *button = list->data;
if(button->tile == tile)
......
......@@ -25,10 +25,16 @@ struct _ButtonWidget
GdkPixmap *pixmap; /*this is the one we start from*/
GdkBitmap *mask;
int pressed; /*true if the button is pressed*/
guint pressed:1; /*true if the button is pressed*/
guint in_button:1;
guint ignore_leave:1; /*ignore the leave notify,
if you do this remember to
set the in_button properly
later!*/
int tile; /*the tile number, only used if tiles are on*/
int arrow; /*0 no arrow, 1 simple arrow, more to do*/
guint tile:2; /*the tile number, only used if tiles are on*/
guint arrow:1; /*0 no arrow, 1 simple arrow, more to do*/
PanelOrientType orient;
};
......@@ -37,7 +43,7 @@ struct _ButtonWidgetClass
GtkWidgetClass parent_class;
void (* clicked) (ButtonWidget *button);
int (* pressed) (ButtonWidget *button);
void (* pressed) (ButtonWidget *button);
void (* unpressed) (ButtonWidget *button);
};
......@@ -45,12 +51,12 @@ guint button_widget_get_type (void);
GtkWidget* button_widget_new (GdkPixmap *pixmap,
GdkBitmap *mask,
int tile,
int arrow,
guint tile,
guint arrow,
PanelOrientType orient);
GtkWidget* button_widget_new_from_file (char *pixmap,
int tile,
int arrow,
guint tile,
guint arrow,
PanelOrientType orient);
void button_widget_draw (ButtonWidget *button,
......@@ -63,17 +69,19 @@ int button_widget_set_pixmap_from_file(ButtonWidget *button,
char *pixmap);
void button_widget_set_params (ButtonWidget *button,
int tile,
int arrow,
guint tile,
guint arrow,
PanelOrientType orient);
void button_widget_clicked (ButtonWidget *button);
int button_widget_down (ButtonWidget *button);
void button_widget_down (ButtonWidget *button);
void button_widget_up (ButtonWidget *button);
void button_widget_load_tile (int tile,
char *tile_up,
char *tile_down);
char *tile_down,
int border,
int depth);
void button_widget_tile_enable (int enabled);
......
......@@ -217,9 +217,9 @@ main(int argc, char **argv)
panel_tooltips = gtk_tooltips_new();
/*FIXME: make this configurable*/
button_widget_load_tile(MENU_TILE,"tile-green-up.png","tile-green-down.png");
button_widget_load_tile(DRAWER_TILE,"tile-purple-up.png","tile-purple-down.png");
button_widget_load_tile(LAUNCHER_TILE,"tile-normal-up.png","tile-normal-down.png");
button_widget_load_tile(MENU_TILE,"tile-green-up.png","tile-green-down.png",2,2);
button_widget_load_tile(DRAWER_TILE,"tile-purple-up.png","tile-purple-down.png",2,2);
button_widget_load_tile(LAUNCHER_TILE,"tile-normal-up.png","tile-normal-down.png",2,2);
button_widget_tile_enable(TRUE);
/*set the globals*/
......
......@@ -1082,6 +1082,8 @@ menu_deactivate(GtkWidget *w, gpointer data)
/* allow the panel to hide again */
if(IS_SNAPPED_WIDGET(panel))
SNAPPED_WIDGET(panel)->autohide_inhibit = FALSE;
BUTTON_WIDGET(menu->button)->in_button = FALSE;
BUTTON_WIDGET(menu->button)->ignore_leave = FALSE;
button_widget_up(BUTTON_WIDGET(menu->button));
}
......@@ -1511,14 +1513,14 @@ add_menu_widget (Menu *menu, GList *menudirl, int main_menu, int fake_subs)
GTK_SIGNAL_FUNC (menu_deactivate), menu);
}
static int
static void
menu_button_pressed(GtkWidget *widget, gpointer data)
{
Menu *menu = data;
GdkEventButton *bevent = (GdkEventButton*)gtk_get_current_event();
GtkWidget *wpanel = get_panel_parent(menu->button);
int main_menu = (strcmp (menu->path, ".") == 0);
check_and_reread(menu->menu,menu,main_menu);
/*so that the panel doesn't pop down until we're
......@@ -1532,11 +1534,12 @@ menu_button_pressed(GtkWidget *widget, gpointer data)
current_panel =
gtk_object_get_data(GTK_OBJECT(menu->button),
PANEL_APPLET_PARENT_KEY);
BUTTON_WIDGET(menu->button)->ignore_leave = TRUE;
gtk_grab_remove(menu->button);
gtk_menu_popup(GTK_MENU(menu->menu), 0,0, menu_position,
data, bevent->button, bevent->time);
return TRUE;
}
static char *
......@@ -1585,8 +1588,8 @@ create_panel_menu (char *menudir, int main_menu,
menu->button = button_widget_new_from_file (pixmap_name,
MENU_TILE,
TRUE,orient);
gtk_signal_connect (GTK_OBJECT (menu->button), "pressed",
GTK_SIGNAL_FUNC (menu_button_pressed), menu);
gtk_signal_connect_after (GTK_OBJECT (menu->button), "pressed",
GTK_SIGNAL_FUNC (menu_button_pressed), menu);
gtk_signal_connect (GTK_OBJECT (menu->button), "destroy",
GTK_SIGNAL_FUNC (destroy_menu), menu);
gtk_widget_show(menu->button);
......
......@@ -75,10 +75,6 @@ typedef void (*AppletSignal) (GtkObject * object,
GtkWidget * applet,
gpointer data);
typedef int (*Button1Signal) (GtkObject * object,
GtkWidget * applet,
gpointer data);
/************************
debugging
************************/
......@@ -137,8 +133,6 @@ enum {
APPLET_ADDED_SIGNAL,
APPLET_REMOVED_SIGNAL,
BACK_CHANGE_SIGNAL,
APPLET_CLICKED_SIGNAL, /*these two are only for NO WINDOW applets, other*/
APPLET_BUTTON1_SIGNAL, /*applets won't get these two*/
LAST_SIGNAL
};
......@@ -190,24 +184,6 @@ marshal_signal_back (GtkObject * object,
func_data);
}
static void
marshal_signal_button1 (GtkObject * object,
GtkSignalFunc func,
gpointer func_data,
GtkArg * args)
{
Button1Signal rfunc;
int *retval;
rfunc = (Button1Signal) func;
retval = GTK_RETLOC_BOOL(args[1]);
*retval = (*rfunc) (object, GTK_VALUE_POINTER (args[0]),
func_data);
}
static void
panel_widget_class_init (PanelWidgetClass *class)
{
......@@ -269,26 +245,6 @@ panel_widget_class_init (PanelWidgetClass *class)
GTK_TYPE_ENUM,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
panel_widget_signals[APPLET_CLICKED_SIGNAL] =
gtk_signal_new("applet_clicked",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
applet_clicked),
marshal_signal_applet,
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
panel_widget_signals[APPLET_BUTTON1_SIGNAL] =
gtk_signal_new("applet_button1",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET(PanelWidgetClass,
applet_button1),
marshal_signal_button1,
GTK_TYPE_BOOL,
1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals(object_class,panel_widget_signals,
LAST_SIGNAL);
......@@ -717,7 +673,7 @@ panel_widget_draw_all(PanelWidget *panel)
gdk_gc_set_fill(gc, GDK_SOLID);
gdk_gc_set_tile(gc, NULL);
for(li = panel->no_window_applet_list; li != NULL;
for(li = panel->applet_list; li != NULL;
li = g_list_next(li)) {
AppletData *ad = li->data;
if(IS_BUTTON_WIDGET(ad->applet))
......@@ -1252,7 +1208,6 @@ is_in_widget(GdkEventButton *bevent, GtkWidget *widget)
return FALSE;
}
static GtkWidget *pressed_applet = NULL;
static int
panel_widget_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{
......@@ -1265,59 +1220,13 @@ panel_widget_event(GtkWidget *widget, GdkEvent *event, gpointer data)
bevent->window != widget->window)
return FALSE;
/*this would be a button release event and it would be right after
a button press*/
if(pressed_applet) {
gdk_pointer_ungrab(GDK_CURRENT_TIME);
gtk_grab_remove(pressed_applet);
if(IS_BUTTON_WIDGET(pressed_applet))
button_widget_up(BUTTON_WIDGET(pressed_applet));
if(is_in_widget(bevent,pressed_applet)) {
if(IS_BUTTON_WIDGET(pressed_applet))
button_widget_clicked(BUTTON_WIDGET(pressed_applet));
else
gtk_signal_emit(GTK_OBJECT(panel),
panel_widget_signals[APPLET_CLICKED_SIGNAL],
pressed_applet);
}
pressed_applet = NULL;
return TRUE;
}
for(list = panel->no_window_applet_list; list!=NULL;
list = g_list_next(list)) {
AppletData *ad = list->data;
if(is_in_widget(bevent,ad->applet)) {
if(bevent->button != 1) {
return panel_widget_applet_event(ad->applet,
event,data);
} else if(event->type == GDK_BUTTON_PRESS) {
if(IS_BUTTON_WIDGET(ad->applet)) {
if(!button_widget_down(BUTTON_WIDGET(ad->applet))) {
pressed_applet = ad->applet;
gtk_grab_add(pressed_applet);
gdk_pointer_grab(widget->window,
FALSE,
APPLET_EVENT_MASK,
NULL,
NULL,
GDK_CURRENT_TIME);
}
} else {
int return_val = FALSE;
gtk_signal_emit(GTK_OBJECT(panel),
panel_widget_signals[APPLET_BUTTON1_SIGNAL],
ad->applet,&return_val);
if(!return_val) {
pressed_applet = ad->applet;
gtk_grab_add(pressed_applet);
}
}
return TRUE;
}
}
if(is_in_widget(bevent,ad->applet) &&
bevent->button != 1)
return panel_widget_applet_event(ad->applet,
event,data);
}
return FALSE;
}
......
......@@ -104,10 +104,6 @@ struct _PanelWidgetClass
PanelBackType type,
char *pixmap,
GdkColor *color);
void (* applet_clicked) (PanelWidget *panel,
GtkWidget *applet);