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

added smooth drawer animation

Sat Apr 11 16:37:27 1998  George Lebl  <jirka@5z.com>

        * panel-widget.[ch], drawer.c: added smooth drawer animation

        * panel.c: deleted an unused function.
parent 9772f108
Sat Apr 11 16:37:27 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch], drawer.c: added smooth drawer animation
* panel.c: deleted an unused function.
Sat Apr 11 12:00:57 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch]: made some parameters global since
......
Sat Apr 11 16:37:27 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch], drawer.c: added smooth drawer animation
* panel.c: deleted an unused function.
Sat Apr 11 12:00:57 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch]: made some parameters global since
......
......@@ -22,36 +22,43 @@
extern GlobalConfig global_config;
/*taken from panel-widget*/
static void
move_window(GtkWidget *widget, int x, int y)
{
gdk_window_set_hints(widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS);
gdk_window_move(widget->window, x, y);
gtk_widget_draw(widget, NULL); /* FIXME: this should draw only the newly exposed area! */
}
void
reposition_drawer(Drawer *drawer)
{
if(PANEL_WIDGET(drawer->drawer)->state == PANEL_SHOWN) {
gint x=0,y=0;
gint wx, wy;
gdk_window_get_origin (drawer->button->window, &wx, &wy);
switch(drawer->orient) {
case DRAWER_UP:
x = wx;
y = wy - drawer->drawer->allocation.height;
break;
case DRAWER_DOWN:
x = wx;
y = wy + drawer->button->allocation.height;
break;
case DRAWER_LEFT:
x = wx - drawer->drawer->allocation.width;
y = wy;
break;
case DRAWER_RIGHT:
x = wx + drawer->button->allocation.width;
y = wy;
break;
}
gtk_widget_set_uposition(drawer->drawer,x,y);
gint x=0,y=0;
gint wx, wy;
gdk_window_get_origin (drawer->button->window, &wx, &wy);
switch(drawer->orient) {
case DRAWER_UP:
x = wx;
y = wy - drawer->drawer->allocation.height;
break;
case DRAWER_DOWN:
x = wx;
y = wy + drawer->button->allocation.height;
break;
case DRAWER_LEFT:
x = wx - drawer->drawer->allocation.width;
y = wy;
break;
case DRAWER_RIGHT:
x = wx + drawer->button->allocation.width;
y = wy;
break;
}
move_window(drawer->drawer,x,y);
}
static gint
......@@ -59,14 +66,12 @@ drawer_click(GtkWidget *widget, gpointer data)
{
Drawer *drawer = data;
if(PANEL_WIDGET(drawer->drawer)->state == PANEL_SHOWN) {
gtk_widget_hide(drawer->drawer);
PANEL_WIDGET(drawer->drawer)->state = PANEL_HIDDEN;
} else {
PANEL_WIDGET(drawer->drawer)->state = PANEL_SHOWN;
reposition_drawer(drawer);
gtk_widget_show(drawer->drawer);
}
reposition_drawer(drawer);
if(PANEL_WIDGET(drawer->drawer)->state == PANEL_SHOWN)
panel_widget_close_drawer(PANEL_WIDGET(drawer->drawer));
else
panel_widget_open_drawer(PANEL_WIDGET(drawer->drawer));
return TRUE;
}
......@@ -113,8 +118,9 @@ create_drawer_applet(GtkWidget * drawer_panel, DrawerOrient orient)
gtk_widget_show(pixmap);
/*FIXME:this is not right, but it's how we can get the buttons to
be 48x48 (given the icons are 48x48)*/
gtk_widget_set_usize (drawer->button, pixmap->requisition.width,
pixmap->requisition.height);
gtk_widget_set_usize (drawer->button,48,48);
/*gtk_widget_set_usize (drawer->button, pixmap->requisition.width,
pixmap->requisition.height);*/
/* put pixmap in button */
gtk_container_add (GTK_CONTAINER(drawer->button), pixmap);
......
......@@ -995,6 +995,102 @@ panel_widget_pop_hide(PanelWidget *panel, int fromright)
panel->state = PANEL_HIDDEN_RIGHT;
}
void
panel_widget_open_drawer(PanelWidget *panel)
{
gint x,y;
gint width, height;
if((panel->state == PANEL_SHOWN) ||
(panel->snapped != PANEL_DRAWER))
return;
panel->state = PANEL_MOVING;
width = GTK_WIDGET(panel)->allocation.width;
height = GTK_WIDGET(panel)->allocation.height;
gdk_window_get_origin(GTK_WIDGET(panel)->window,&x,&y);
if(panel->orient == PANEL_HORIZONTAL) {
if(panel->drawer_drop_zone_pos==DROP_ZONE_LEFT) {
move_window(GTK_WIDGET(panel),x+width,y);
gtk_widget_show(GTK_WIDGET(panel));
move_horiz(panel, x+width, x,
pw_explicit_step);
} else {
move_window(GTK_WIDGET(panel),x-width,y);
gtk_widget_show(GTK_WIDGET(panel));
move_horiz(panel, x-width, x,
pw_explicit_step);
}
} else {
if(panel->drawer_drop_zone_pos==DROP_ZONE_LEFT) {
move_window(GTK_WIDGET(panel),x,y+height);
gtk_widget_show(GTK_WIDGET(panel));
move_vert(panel, y+height, y,
pw_explicit_step);
} else {
move_window(GTK_WIDGET(panel),x,y-height);
gtk_widget_show(GTK_WIDGET(panel));
move_vert(panel, y-height, y,
pw_explicit_step);
}
}
panel->state = PANEL_SHOWN;
gtk_signal_emit(GTK_OBJECT(panel),
panel_widget_signals[STATE_CHANGE_SIGNAL],
PANEL_SHOWN);
}
void
panel_widget_close_drawer(PanelWidget *panel)
{
gint x,y;
gint width, height;
if((panel->state != PANEL_SHOWN) ||
(panel->snapped != PANEL_DRAWER))
return;
gtk_signal_emit(GTK_OBJECT(panel),
panel_widget_signals[STATE_CHANGE_SIGNAL],
PANEL_HIDDEN);
panel->state = PANEL_MOVING;
width = GTK_WIDGET(panel)->allocation.width;
height = GTK_WIDGET(panel)->allocation.height;
gdk_window_get_origin(GTK_WIDGET(panel)->window,&x,&y);
if(panel->orient == PANEL_HORIZONTAL) {
if(panel->drawer_drop_zone_pos==DROP_ZONE_LEFT)
move_horiz(panel, x, x+width,
pw_explicit_step);
else
move_horiz(panel, x, x-width,
pw_explicit_step);
} else {
if(panel->drawer_drop_zone_pos==DROP_ZONE_LEFT)
move_vert(panel, y, y+height,
pw_explicit_step);
else
move_vert(panel, y, y-height,
pw_explicit_step);
}
panel->state = PANEL_HIDDEN;
gtk_widget_hide(GTK_WIDGET(panel));
move_window(GTK_WIDGET(panel),x,y);
}
static gint
panel_show_hide_right(GtkWidget *widget, gpointer data)
{
......@@ -1544,7 +1640,7 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
PanelWidget *assoc = gtk_object_get_data(GTK_OBJECT(applet),
PANEL_APPLET_ASSOC_PANEL_KEY);
if(!panel_widget_is_cursor(panel,0)) {
if(!panel_widget_is_cursor(panel,10)) {
GList *list;
for(list=panels;
list!=NULL;
......@@ -1553,8 +1649,7 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
PANEL_WIDGET(list->data);
if(panel != new_panel &&
panel_widget_is_cursor(new_panel,
panel->snapped==PANEL_DRAWER?20:0) &&
panel_widget_is_cursor(new_panel,0) &&
new_panel != assoc) {
pos = panel_widget_get_moveby(panel,0);
panel_widget_reparent(panel,
......@@ -1570,6 +1665,7 @@ panel_widget_applet_move_to_cursor(PanelWidget *panel)
return FALSE;
}
}
return TRUE;
}
gtk_widget_get_pointer(panel->fixed, &x, &y);
......
......@@ -158,6 +158,12 @@ void panel_widget_foreach (PanelWidget *panel,
state to drawers and such*/
void panel_widget_restore_state (PanelWidget *panel);
/*open and close drawers*/
void panel_widget_open_drawer (PanelWidget *panel);
void panel_widget_close_drawer (PanelWidget *panel);
/*initiate drag*/
void panel_widget_applet_drag_start (PanelWidget *panel,
GtkWidget *applet);
......
......@@ -39,22 +39,6 @@ extern GlobalConfig global_config;
extern char *panel_cfg_path;
/*static void
get_applet_geometry(GtkWidget *applet, int *x, int *y, int *width, int *height)
{
if (x)
*x = applet->allocation.x;
if (y)
*y = applet->allocation.y;
if (width)
*width = applet->allocation.width;
if (height)
*height = applet->allocation.height;
}*/
void
apply_global_config(void)
{
......
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