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

minor fixes, remove blocking as it is not needed

Sun May 03 03:35:05 1998  George Lebl  <jirka@5z.com>

        * panel-widget.[ch]: minor fixes, remove blocking
          as it is not needed

        * panel.c: minor fixes
parent e6c4f8ea
Sun May 03 03:35:05 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch]: minor fixes, remove blocking
as it is not needed
* panel.c: minor fixes
Sun May 03 02:52:40 1998 George Lebl <jirka@5z.com> Sun May 03 02:52:40 1998 George Lebl <jirka@5z.com>
* panel.c: clean section before saving applet info * panel.c: clean section before saving applet info
......
Sun May 03 03:35:05 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch]: minor fixes, remove blocking
as it is not needed
* panel.c: minor fixes
Sun May 03 02:52:40 1998 George Lebl <jirka@5z.com> Sun May 03 02:52:40 1998 George Lebl <jirka@5z.com>
* panel.c: clean section before saving applet info * panel.c: clean section before saving applet info
......
...@@ -489,7 +489,7 @@ get_applet_data_pos(PanelWidget *panel, gint pos) ...@@ -489,7 +489,7 @@ get_applet_data_pos(PanelWidget *panel, gint pos)
/*temporairly using _, we will switch over to this function completely /*temporairly using _, we will switch over to this function completely
in time*/ in time*/
static void static void
_panel_widget_applet_put(PanelWidget *panel,AppletData *ad) panel_widget_applet_put(PanelWidget *panel,AppletData *ad)
{ {
gint width, height; gint width, height;
gint x,y; gint x,y;
...@@ -522,19 +522,13 @@ _panel_widget_applet_put(PanelWidget *panel,AppletData *ad) ...@@ -522,19 +522,13 @@ _panel_widget_applet_put(PanelWidget *panel,AppletData *ad)
} }
} }
static void
panel_widget_applet_put(PanelWidget *panel,gint pos)
{
_panel_widget_applet_put(panel,get_applet_data_pos(panel,pos));
}
static void static void
panel_widget_put_all(PanelWidget *panel) panel_widget_put_all(PanelWidget *panel)
{ {
GList *list; GList *list;
for(list=panel->applet_list;list!=NULL;list=g_list_next(list)) for(list=panel->applet_list;list!=NULL;list=g_list_next(list))
_panel_widget_applet_put(panel,list->data); panel_widget_applet_put(panel,list->data);
} }
static void static void
...@@ -612,7 +606,7 @@ panel_widget_right_stick(PanelWidget *panel,gint old_size) ...@@ -612,7 +606,7 @@ panel_widget_right_stick(PanelWidget *panel,gint old_size)
} while(ad->pos+ad->cells == i); } while(ad->pos+ad->cells == i);
for(list = prev;list!=NULL;list=g_list_next(list)) for(list = prev;list!=NULL;list=g_list_next(list))
_panel_widget_applet_put(panel,list->data); panel_widget_applet_put(panel,list->data);
} }
static gint static gint
...@@ -649,7 +643,7 @@ panel_widget_push_left(PanelWidget *panel,AppletData *oad) ...@@ -649,7 +643,7 @@ panel_widget_push_left(PanelWidget *panel,AppletData *oad)
ad=list->data; ad=list->data;
ad->pos--; ad->pos--;
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
if(ad == oad) if(ad == oad)
break; break;
} }
...@@ -698,7 +692,7 @@ panel_widget_push_right(PanelWidget *panel,AppletData *oad) ...@@ -698,7 +692,7 @@ panel_widget_push_right(PanelWidget *panel,AppletData *oad)
ad=list->data; ad=list->data;
ad->pos++; ad->pos++;
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
if(ad == oad) if(ad == oad)
break; break;
} }
...@@ -712,14 +706,8 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -712,14 +706,8 @@ panel_widget_seize_space(PanelWidget *panel,
AppletData *ad) AppletData *ad)
{ {
gint i; gint i;
gint orig_block = FALSE;
GList *list,*rlist,*llist; GList *list,*rlist,*llist;
if(ad==panel->currently_dragged_applet) {
orig_block = panel->drag_blocked;
panel->drag_blocked = TRUE;
}
if(width%PANEL_CELL_SIZE) width--; /*just so that I get if(width%PANEL_CELL_SIZE) width--; /*just so that I get
the right size*/ the right size*/
/*convert width from pixels to cells*/ /*convert width from pixels to cells*/
...@@ -729,16 +717,11 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -729,16 +717,11 @@ panel_widget_seize_space(PanelWidget *panel,
panel_widget_pack_applets(panel); panel_widget_pack_applets(panel);
/*we already have enough space*/ /*we already have enough space*/
if(width <= ad->cells) { if(width <= ad->cells)
panel->drag_blocked = orig_block;
return; return;
}
list = g_list_find(panel->applet_list,ad); list = g_list_find(panel->applet_list,ad);
if(!list) { g_return_if_fail(list!=NULL);
panel->drag_blocked = orig_block;
g_return_if_fail(list!=NULL);
}
/*try how much free space is on the right*/ /*try how much free space is on the right*/
rlist = g_list_next(list); rlist = g_list_next(list);
...@@ -746,7 +729,6 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -746,7 +729,6 @@ panel_widget_seize_space(PanelWidget *panel,
AppletData *wad = rlist->data; AppletData *wad = rlist->data;
if(ad->pos+width-1 < wad->pos) { if(ad->pos+width-1 < wad->pos) {
ad->cells = width; ad->cells = width;
panel->drag_blocked = orig_block;
return; return;
} }
ad->cells = wad->pos - ad->pos; ad->cells = wad->pos - ad->pos;
...@@ -758,7 +740,6 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -758,7 +740,6 @@ panel_widget_seize_space(PanelWidget *panel,
panel->size = ad->pos+width; panel->size = ad->pos+width;
panel_widget_set_size(panel,panel->size); panel_widget_set_size(panel,panel->size);
} }
panel->drag_blocked = orig_block;
return; return;
} }
ad->cells = panel->size - ad->pos; ad->cells = panel->size - ad->pos;
...@@ -771,8 +752,7 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -771,8 +752,7 @@ panel_widget_seize_space(PanelWidget *panel,
if(wad->pos+wad->cells-1 < ad->pos+ad->cells-width) { if(wad->pos+wad->cells-1 < ad->pos+ad->cells-width) {
ad->pos = ad->pos+ad->cells-width; ad->pos = ad->pos+ad->cells-width;
ad->cells = width; ad->cells = width;
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
panel->drag_blocked = orig_block;
return; return;
} }
ad->cells += ad->pos-(wad->pos+wad->cells); ad->cells += ad->pos-(wad->pos+wad->cells);
...@@ -781,8 +761,7 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -781,8 +761,7 @@ panel_widget_seize_space(PanelWidget *panel,
if(0 <= ad->pos+ad->cells-width) { if(0 <= ad->pos+ad->cells-width) {
ad->pos = ad->pos+ad->cells-width; ad->pos = ad->pos+ad->cells-width;
ad->cells = width; ad->cells = width;
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
panel->drag_blocked = orig_block;
return; return;
} }
ad->cells += ad->pos; ad->cells += ad->pos;
...@@ -804,9 +783,7 @@ panel_widget_seize_space(PanelWidget *panel, ...@@ -804,9 +783,7 @@ panel_widget_seize_space(PanelWidget *panel,
} }
} }
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
panel->drag_blocked = orig_block;
} }
static void static void
...@@ -836,7 +813,7 @@ panel_widget_adjust_applet(PanelWidget *panel, AppletData *ad) ...@@ -836,7 +813,7 @@ panel_widget_adjust_applet(PanelWidget *panel, AppletData *ad)
else else
panel_widget_seize_space(panel,height,ad); panel_widget_seize_space(panel,height,ad);
} }
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
} }
...@@ -852,15 +829,15 @@ panel_widget_switch_applet_right(PanelWidget *panel, GList *list) ...@@ -852,15 +829,15 @@ panel_widget_switch_applet_right(PanelWidget *panel, GList *list)
nad = nlist->data; nad = nlist->data;
if(!nlist || nad->pos > ad->pos+ad->cells) { if(!nlist || nad->pos > ad->pos+ad->cells) {
ad->pos++; ad->pos++;
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
return; return;
} }
nad->pos = ad->pos; nad->pos = ad->pos;
ad->pos = nad->pos+nad->cells; ad->pos = nad->pos+nad->cells;
panel->applet_list = my_g_list_swap_prev(panel->applet_list,nlist); panel->applet_list = my_g_list_swap_prev(panel->applet_list,nlist);
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
_panel_widget_applet_put(panel,nad); panel_widget_applet_put(panel,nad);
} }
static void static void
...@@ -875,15 +852,15 @@ panel_widget_switch_applet_left(PanelWidget *panel, GList *list) ...@@ -875,15 +852,15 @@ panel_widget_switch_applet_left(PanelWidget *panel, GList *list)
pad = nlist->data; pad = nlist->data;
if(!nlist || pad->pos+pad->cells < ad->pos) { if(!nlist || pad->pos+pad->cells < ad->pos) {
ad->pos--; ad->pos--;
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
return; return;
} }
ad->pos = pad->pos; ad->pos = pad->pos;
pad->pos = ad->pos+ad->cells; pad->pos = ad->pos+ad->cells;
panel->applet_list = my_g_list_swap_next(panel->applet_list,nlist); panel->applet_list = my_g_list_swap_next(panel->applet_list,nlist);
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
_panel_widget_applet_put(panel,pad); panel_widget_applet_put(panel,pad);
} }
static gint static gint
...@@ -2296,7 +2273,7 @@ panel_widget_nice_move(PanelWidget *panel, AppletData *ad, gint pos) ...@@ -2296,7 +2273,7 @@ panel_widget_nice_move(PanelWidget *panel, AppletData *ad, gint pos)
my_g_list_resort(panel->applet_list,ad, my_g_list_resort(panel->applet_list,ad,
(GCompareFunc)applet_data_compare); (GCompareFunc)applet_data_compare);
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
} }
...@@ -2304,9 +2281,6 @@ panel_widget_nice_move(PanelWidget *panel, AppletData *ad, gint pos) ...@@ -2304,9 +2281,6 @@ panel_widget_nice_move(PanelWidget *panel, AppletData *ad, gint pos)
gint gint
panel_widget_applet_move_to_cursor(PanelWidget *panel) panel_widget_applet_move_to_cursor(PanelWidget *panel)
{ {
/*blocked, so don't do anything*/
if (panel->drag_blocked)
return TRUE;
if (panel->currently_dragged_applet) { if (panel->currently_dragged_applet) {
gint x,y; gint x,y;
gint moveby; gint moveby;
...@@ -2332,22 +2306,18 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel) ...@@ -2332,22 +2306,18 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
pos = 0; pos = 0;
/*disable reentrancy into this /*disable reentrancy into this
function*/ function*/
panel->drag_blocked = TRUE;
if(panel_widget_reparent(panel, if(panel_widget_reparent(panel,
new_panel, new_panel,
applet, applet,
pos)==-1) { pos)==-1)
/*can't find a free pos /*can't find a free pos
so cancel the reparent*/ so cancel the reparent*/
panel->drag_blocked = FALSE;
continue; continue;
}
_panel_widget_applet_drag_end(panel); _panel_widget_applet_drag_end(panel);
_panel_widget_applet_drag_start( _panel_widget_applet_drag_start(
new_panel, applet); new_panel, applet);
panel_widget_applet_move_use_idle( panel_widget_applet_move_use_idle(
new_panel); new_panel);
panel->drag_blocked = FALSE;
return FALSE; return FALSE;
} }
} }
...@@ -2604,7 +2574,7 @@ panel_widget_make_empty_pos(PanelWidget *panel, gint pos) ...@@ -2604,7 +2574,7 @@ panel_widget_make_empty_pos(PanelWidget *panel, gint pos)
if(list) if(list)
rad = list->data; rad = list->data;
if(ad->pos+ad->cells < rad->pos) if(!list || ad->pos+ad->cells < rad->pos)
return ad->pos+ad->cells; return ad->pos+ad->cells;
if(panel_widget_push_right(panel,rad)) if(panel_widget_push_right(panel,rad))
...@@ -2811,7 +2781,7 @@ panel_widget_move (PanelWidget *panel, GtkWidget *applet, gint pos) ...@@ -2811,7 +2781,7 @@ panel_widget_move (PanelWidget *panel, GtkWidget *applet, gint pos)
g_list_insert_sorted(panel->applet_list,ad, g_list_insert_sorted(panel->applet_list,ad,
(GCompareFunc)applet_data_compare); (GCompareFunc)applet_data_compare);
_panel_widget_applet_put(panel,ad); panel_widget_applet_put(panel,ad);
return pos; return pos;
} }
...@@ -2840,9 +2810,11 @@ panel_widget_remove (PanelWidget *panel, GtkWidget *applet) ...@@ -2840,9 +2810,11 @@ panel_widget_remove (PanelWidget *panel, GtkWidget *applet)
/*remove applet*/ /*remove applet*/
gtk_container_remove(GTK_CONTAINER(panel->fixed),applet); gtk_container_remove(GTK_CONTAINER(panel->fixed),applet);
if(panel->snapped==PANEL_DRAWER) if(panel->snapped==PANEL_DRAWER)
panel_widget_pack_applets(panel); panel_widget_pack_applets(panel);
thick = panel_widget_get_thick(panel); thick = panel_widget_get_thick(panel);
if(panel->thick != thick) { if(panel->thick != thick) {
panel->thick = thick; panel->thick = thick;
......
...@@ -99,7 +99,6 @@ struct _PanelWidget ...@@ -99,7 +99,6 @@ struct _PanelWidget
gint leave_notify_timer_tag; gint leave_notify_timer_tag;
AppletData *currently_dragged_applet; AppletData *currently_dragged_applet;
gint drag_blocked;
DrawerDropZonePos drawer_drop_zone_pos; DrawerDropZonePos drawer_drop_zone_pos;
gint x; gint x;
......
...@@ -756,20 +756,6 @@ applet_register (const char * ior, int applet_id) ...@@ -756,20 +756,6 @@ applet_register (const char * ior, int applet_id)
orientation_change(applet_id,panel); orientation_change(applet_id,panel);
} }
/* fixed in libgnomeui now
static gint
socket_destroy(GtkWidget *widget, gpointer data)
{
GtkSocket *socket = GTK_SOCKET(widget);
gdk_window_destroy_notify (socket->plug_window);
gdk_window_destroy (socket->plug_window);
socket->plug_window = NULL;
return FALSE;
}
*/
/*note that type should be APPLET_EXTERN_RESERVED or APPLET_EXTERN_PENDING /*note that type should be APPLET_EXTERN_RESERVED or APPLET_EXTERN_PENDING
only*/ only*/
guint32 guint32
...@@ -780,11 +766,6 @@ reserve_applet_spot (const char *id_str, const char *path, int panel, ...@@ -780,11 +766,6 @@ reserve_applet_spot (const char *id_str, const char *path, int panel,
socket = gtk_socket_new(); socket = gtk_socket_new();
/*fixed in libgnomeui now*/
/*gtk_signal_connect(GTK_OBJECT(socket),"destroy",
GTK_SIGNAL_FUNC(socket_destroy),
NULL);*/
g_return_val_if_fail(socket!=NULL,0); g_return_val_if_fail(socket!=NULL,0);
gtk_widget_show (socket); gtk_widget_show (socket);
...@@ -914,6 +895,8 @@ applet_destroy(GtkWidget *w, gpointer data) ...@@ -914,6 +895,8 @@ applet_destroy(GtkWidget *w, gpointer data)
info->widget = NULL; info->widget = NULL;
panel_clean_applet(applet_id); panel_clean_applet(applet_id);
return FALSE;
} }
gint gint
......
...@@ -152,7 +152,6 @@ void orientation_change(gint applet_id, PanelWidget *panel); ...@@ -152,7 +152,6 @@ void orientation_change(gint applet_id, PanelWidget *panel);
# define ITOP(i) (gpointer)((gshort)i) # define ITOP(i) (gpointer)((gshort)i)
#endif #endif
END_GNOME_DECLS END_GNOME_DECLS
#endif #endif
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