diff options
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/ChangeLog | 7 | ||||
-rw-r--r-- | widgets/misc/e-dateedit.c | 34 |
2 files changed, 29 insertions, 12 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index d75d654f96..07cae36fc8 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,10 @@ +2003-02-01 Hans Petter Jansson <hpj@ximian.com> + + * e-dateedit.c (create_children): Don't request combo boxes that are + 0 pixels tall. + (position_date_popup): Make this work when the button doesn't have + its own window. + 2003-01-26 Chris Toshok <toshok@ximian.com> * e-clipped-label.c (e_clipped_label_new): init the layout to diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 72dcb15772..79982be307 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -324,7 +324,7 @@ create_children (EDateEdit *dedit) priv = dedit->priv; priv->date_entry = gtk_entry_new (); - gtk_widget_set_size_request (priv->date_entry, 90, 0); + gtk_widget_set_size_request (priv->date_entry, 90, -1); gtk_box_pack_start (GTK_BOX (dedit), priv->date_entry, FALSE, TRUE, 0); g_signal_connect (priv->date_entry, "key_press_event", @@ -356,7 +356,7 @@ create_children (EDateEdit *dedit) priv->time_combo = gtk_combo_new (); - gtk_widget_set_size_request (GTK_COMBO (priv->time_combo)->entry, 90, 0); + gtk_widget_set_size_request (GTK_COMBO (priv->time_combo)->entry, 90, -1); gtk_box_pack_start (GTK_BOX (dedit), priv->time_combo, FALSE, TRUE, 0); rebuild_time_popup (dedit); @@ -1208,24 +1208,34 @@ static void position_date_popup (EDateEdit *dedit) { gint x, y; + gint win_x, win_y; gint bwidth, bheight; - GtkRequisition req; + GtkRequisition cal_req, button_req; gint screen_width, screen_height; - gtk_widget_size_request (dedit->priv->cal_popup, &req); + gtk_widget_size_request (dedit->priv->cal_popup, &cal_req); - gdk_window_get_origin (dedit->priv->date_button->window, &x, &y); - gdk_window_get_size (dedit->priv->date_button->window, - &bwidth, &bheight); + gtk_widget_size_request (dedit->priv->date_button, &button_req); + bwidth = button_req.width; + gtk_widget_size_request (gtk_widget_get_parent (dedit->priv->date_button), &button_req); + bheight = button_req.height; + + gtk_widget_translate_coordinates (dedit->priv->date_button, + gtk_widget_get_toplevel (dedit->priv->date_button), + bwidth - cal_req.width, bheight, + &x, &y); + + gdk_window_get_origin (gtk_widget_get_toplevel (dedit->priv->date_button)->window, + &win_x, &win_y); + + x += win_x; + y += win_y; screen_width = gdk_screen_width (); screen_height = gdk_screen_height (); - x += bwidth - req.width; - y += bheight; - - x = CLAMP (x, 0, MAX (0, screen_width - req.width)); - y = CLAMP (y, 0, MAX (0, screen_height - req.height)); + x = CLAMP (x, 0, MAX (0, screen_width - cal_req.width)); + y = CLAMP (y, 0, MAX (0, screen_height - cal_req.height)); gtk_widget_set_uposition (dedit->priv->cal_popup, x, y); } |