applied patch to fix draw_indicator behaviour from Lars Hamann and Stefan

Tue Feb 17 05:41:31 1998  Tim Janik  <timj@gimp.org>

        * gtk/gtkcheckbutton.c:
        * gtk/gtkradiobutton.c:
        * gtk/gtktogglebutton.c:
          applied patch to fix draw_indicator behaviour from Lars Hamann
          and Stefan Jeske.

        * gtk/gtkmain.h:
        * gtk/gtkmain.c (gtk_grab_get_current): new function
          that returns the current grab widget or NULL.

        * gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
          shape mask if mask==NULL (provided by Stefan Wille).
This commit is contained in:
Tim Janik 1998-02-17 06:03:40 +00:00 committed by Tim Janik
parent 9f96d18eb1
commit a303493882
15 changed files with 208 additions and 46 deletions

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1,3 +1,18 @@
Tue Feb 17 05:41:31 1998 Tim Janik <timj@gimp.org>
* gtk/gtkcheckbutton.c:
* gtk/gtkradiobutton.c:
* gtk/gtktogglebutton.c:
applied patch to fix draw_indicator behaviour from Lars Hamann
and Stefan Jeske.
* gtk/gtkmain.h:
* gtk/gtkmain.c (gtk_grab_get_current): new function
that returns the current grab widget or NULL.
* gdk/gdkwindow.c (gdk_window_shape_combine_mask): remove
shape mask if mask==NULL (provided by Stefan Wille).
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)

View File

@ -1255,21 +1255,33 @@ gdk_window_shape_combine_mask (GdkWindow *window,
gint x, gint y)
{
GdkWindowPrivate *window_private;
GdkWindowPrivate *pixmap_private;
Pixmap pixmap;
g_return_if_fail (window != NULL);
g_return_if_fail (mask != NULL);
window_private = (GdkWindowPrivate*) window;
pixmap_private = (GdkWindowPrivate*) mask;
if (window_private->destroyed)
return;
if (mask)
{
GdkWindowPrivate *pixmap_private;
pixmap_private = (GdkWindowPrivate*) mask;
pixmap = (Pixmap) pixmap_private->xwindow;
}
else
{
x = 0;
y = 0;
pixmap = None;
}
XShapeCombineMask (window_private->xdisplay,
window_private->xwindow,
ShapeBounding,
x, y, /* offset */
(Pixmap)pixmap_private->xwindow,
x, y,
pixmap,
ShapeSet);
}

View File

@ -1255,21 +1255,33 @@ gdk_window_shape_combine_mask (GdkWindow *window,
gint x, gint y)
{
GdkWindowPrivate *window_private;
GdkWindowPrivate *pixmap_private;
Pixmap pixmap;
g_return_if_fail (window != NULL);
g_return_if_fail (mask != NULL);
window_private = (GdkWindowPrivate*) window;
pixmap_private = (GdkWindowPrivate*) mask;
if (window_private->destroyed)
return;
if (mask)
{
GdkWindowPrivate *pixmap_private;
pixmap_private = (GdkWindowPrivate*) mask;
pixmap = (Pixmap) pixmap_private->xwindow;
}
else
{
x = 0;
y = 0;
pixmap = None;
}
XShapeCombineMask (window_private->xdisplay,
window_private->xwindow,
ShapeBounding,
x, y, /* offset */
(Pixmap)pixmap_private->xwindow,
x, y,
pixmap,
ShapeSet);
}

View File

@ -161,21 +161,26 @@ gtk_check_button_draw_focus (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
if (GTK_WIDGET_DRAWABLE (widget))
{
check_button = GTK_CHECK_BUTTON (widget);
if (check_button->toggle_button.draw_indicator)
{
gint border_width;
border_width = GTK_CONTAINER (widget)->border_width;
if (GTK_WIDGET_HAS_FOCUS (widget))
gdk_draw_rectangle (widget->window,
widget->style->black_gc, FALSE, 0, 0,
widget->allocation.width - 1,
widget->allocation.height - 1);
widget->style->black_gc, FALSE,
border_width, border_width,
widget->allocation.width - 2 * border_width - 1,
widget->allocation.height - 2 * border_width - 1);
else
gdk_draw_rectangle (widget->window,
widget->style->bg_gc[GTK_STATE_NORMAL], FALSE, 0, 0,
widget->allocation.width - 1,
widget->allocation.height - 1);
widget->style->bg_gc[GTK_STATE_NORMAL], FALSE,
border_width, border_width,
widget->allocation.width - 2 * border_width - 1,
widget->allocation.height - 2 * border_width - 1);
}
else
{
@ -322,6 +327,8 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
GtkToggleButton *toggle_button;
GtkStateType state_type;
GtkShadowType shadow_type;
GdkRectangle restrict_area;
GdkRectangle new_area;
gint width, height;
gint x, y;
@ -338,8 +345,17 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
(state_type != GTK_STATE_PRELIGHT))
state_type = GTK_STATE_NORMAL;
restrict_area.x = GTK_CONTAINER (widget)->border_width;
restrict_area.y = restrict_area.x;
restrict_area.width = widget->allocation.width - restrict_area.x * 2;
restrict_area.height = widget->allocation.height - restrict_area.x * 2;
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
{
gtk_style_set_background (widget->style, widget->window, state_type);
gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
gdk_window_clear_area (widget->window, new_area.x, new_area.y,
new_area.width, new_area.height);
}
x = CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;

View File

@ -514,6 +514,14 @@ gtk_grab_add (GtkWidget *widget)
}
}
GtkWidget*
gtk_grab_get_current (void)
{
if (grabs)
return GTK_WIDGET (grabs->data);
return NULL;
}
void
gtk_grab_remove (GtkWidget *widget)
{

View File

@ -55,6 +55,7 @@ gint gtk_true (void);
gint gtk_false (void);
void gtk_grab_add (GtkWidget *widget);
GtkWidget* gtk_grab_get_current (void);
void gtk_grab_remove (GtkWidget *widget);
void gtk_init_add (GtkFunction function,

View File

@ -270,6 +270,8 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
GtkToggleButton *toggle_button;
GtkStateType state_type;
GtkShadowType shadow_type;
GdkRectangle restrict_area;
GdkRectangle new_area;
GdkPoint pts[4];
gint width, height;
gint x, y;
@ -288,8 +290,17 @@ gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
(state_type != GTK_STATE_PRELIGHT))
state_type = GTK_STATE_NORMAL;
restrict_area.x = GTK_CONTAINER (widget)->border_width;
restrict_area.y = restrict_area.x;
restrict_area.width = widget->allocation.width - restrict_area.x * 2;
restrict_area.height = widget->allocation.height - restrict_area.x * 2;
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
{
gtk_style_set_background (widget->style, widget->window, state_type);
gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
gdk_window_clear_area (widget->window, new_area.x, new_area.y,
new_area.width, new_area.height);
}
x = CHECK_BUTTON_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width;
y = (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;

View File

@ -181,15 +181,15 @@ gtk_toggle_button_draw_focus (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
if (GTK_WIDGET_DRAWABLE (widget))
{
button = GTK_BUTTON (widget);
toggle_button = GTK_TOGGLE_BUTTON (widget);
x = 0;
y = 0;
width = widget->allocation.width;
height = widget->allocation.height;
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
if (GTK_WIDGET_CAN_DEFAULT (widget))
{

View File

@ -3728,15 +3728,12 @@ gtk_widget_shape_combine_mask (GtkWidget *widget,
{
GTK_PRIVATE_UNSET_FLAG (widget, GTK_HAS_SHAPE_MASK);
if (widget->window)
gdk_window_shape_combine_mask (widget->window, NULL, 0, 0);
shape_info = gtk_object_get_data (GTK_OBJECT (widget), shape_info_key);
gtk_object_remove_data (GTK_OBJECT (widget), shape_info_key);
g_free (shape_info);
if (widget->window)
{
/* FIXME: we need gdk code here that removes the shape from a window
*/
}
}
else
{