patch for gtkbutton.c
- From: <nuke bayside net>
- To: gtk-list redhat com
- Subject: patch for gtkbutton.c
- Date: Mon, 9 Feb 1998 10:28:05 +0000 (GMT)
this is a patch for gtkbutton.c that (IMO) improves the button feel a
little.. text appears to press along with the button, and when a button is
held down, the cursor is moved out and back into the button, it represses.
i just thought we needed something like this :) if the text thing isn't
in the "gtk nature", just the button press code would be good.
--- ../../gtk+-0.99.3-orig/gtk/gtkbutton.c Wed Jan 21 04:40:47 1998
+++ gtkbutton.c Mon Feb 9 10:10:42 1998
@@ -865,6 +865,8 @@
if (GTK_WIDGET_STATE (button) != new_state)
{
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.x++;
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.y++;
gtk_widget_set_state (GTK_WIDGET (button), new_state);
gtk_widget_queue_draw (GTK_WIDGET (button));
}
@@ -889,6 +891,8 @@
if (GTK_WIDGET_STATE (button) != new_state)
{
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.x--;
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.y--;
gtk_widget_set_state (GTK_WIDGET (button), new_state);
gtk_widget_queue_draw (GTK_WIDGET (button));
}
@@ -905,11 +909,19 @@
new_state = (button->button_down ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
- if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
+ if (button->button_down == TRUE)
+ {
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.x++;
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.y++;
+ gtk_widget_set_state (GTK_WIDGET (button), GTK_STATE_ACTIVE);
gtk_widget_queue_draw (GTK_WIDGET (button));
- }
+ }
+ else
+ if (GTK_WIDGET_STATE (button) != new_state)
+ {
+ gtk_widget_set_state (GTK_WIDGET (button), new_state);
+ gtk_widget_queue_draw (GTK_WIDGET (button));
+ }
}
static void
@@ -918,6 +930,12 @@
g_return_if_fail (button != NULL);
g_return_if_fail (GTK_IS_BUTTON (button));
+ if (button->button_down == TRUE)
+ {
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.x--;
+ GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child))->allocation.y--;
+ gtk_widget_queue_draw (GTK_WIDGET(GTK_LABEL(GTK_BUTTON(button)->child)));
+ }
if (GTK_WIDGET_STATE (button) != GTK_STATE_NORMAL)
{
gtk_widget_set_state (GTK_WIDGET (button), GTK_STATE_NORMAL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]