[Usability]Re: The whole panel focus/keynav thing
- From: "Padraig O'Briain" <Padraig Obriain sun com>
- To: gnome-accessibility-list gnome org, desktop-devel-list gnome org, usability gnome org, calum benson sun com
- Subject: [Usability]Re: The whole panel focus/keynav thing
- Date: Tue, 14 May 2002 09:20:20 +0100 (BST)
I have patches for gnome-panel which do the following:
1) Remove the capability of focusing the PanelWidget using Ctrl+Tab
2) Add support for popping up PanelWidget's context menu by pressing Ctrl+F10.
3) Set state of PanelWidget and its children to SELECTED when focus is in panel.
4) Add default panel rc file (panelrc) installed in $(datadir)/gnome-panel which
causes SELECTED state to look the same as NORMAL state for PanelWidget and
applets. To see focus indicator for panel add the following lines to .gtkrc-2.0.
style "prelight-selected"
{
fg[SELECTED] = { 0, 0, 0 }
bg[SELECTED] = { 0xea60, 0xea60, 0xea60 }
}
widget_class "*PanelWidget*" style "prelight-selected"
widget_class "*PanelApplet*" style "prelight-selected"
5) Load default panel rc file at startup of gnome-panel and out-of-process
applets.
4) Use style value for focus-line-with and focus-padding when drawing focus
indicator, instead of using hardcoded values.
6) Highlight ButtonWidget when it has focus.
Feedback requested.
Padraig
>
> Yes, I'm sure you hoped it had just gone away for good :) But with the
> final UI freeze looming fast, we need to nail the whole issue about
> panel keynav, and showing panel focus.
>
> We know you didn't like what we did last time, so here's our new
> proposal, which, unless there are any obvious issues or better ideas
> that haven't already been shouted down in previous discussions, we'll be
> unleashing Padraig on to implement anytime soon...
>
> Executive summary: by default, you won't notice anything different from
> what currently happens ("currently" meaning "since the highlighting was
> removed again", that is!). Except that when they're focused, you'll get
> a normal focus indicator around some applets that don't currently have
> them.
>
> The details:
>
> 1) The panel background will no longer be focusable, except when there
> are no objects on it. Instead, focusing a panel will always give focus
> to an object *on* the panel.
>
> 2) By default, the panel background will not highlight when an object on
> the panel has focus. Well actually, it will, but the default will be to
> use the same colour as the panel background, so you won't notice--
> honest :) This means that people who *need* the panel highlight can
> easily get it thematically, by changing the panel background highlight
> colour. Panels with pixmap backgrounds will be unaffected, their
> backgrounds won't highlight regardless.
>
> 3) To pop up the panel right-click menu, instead of focusing the panel
> background (which won't be possible any more) and pressing Shift-F10,
> there will be an additional keyboard shortcut available, probably
> something like Ctrl-F10 or Alt-F10, that pops up the panel menu when any
> object on the panel has focus. (Or when the panel background has focus,
> if the panel is empty).
>
> 4) Applets: we may have to shave a pixel or two off the heights of some
> applets to leave room to show a discernable focus indicator. However,
> some of them already seem to have some padding around them, so hopefully
> we'll be able to minimise the amount of shaving we need to do :) If we
> can still make the active area extend right to the edge of the screen
> for applets on edge panels, we will*. But usability-wise it's slightly
> less important that this works for applets anyway, as in many cases
> there's not much to gain by just clicking on an applet-- you often need
> to click on a particular control or area inside the applet instead, so
> having the edge of the screen available as a big target doesn't really
> improve matters there.
>
> That is all... suggestions/objections to be filed in writing ASAP :o)
>
> Cheeri,
> Calum.
>
> * Although this already seems to be broken for non-menu panels (e.g. the
> window list, which goes right up to the top of the screen if you stick
> it on the menu panel, but not right down to the bottom when it's on the
> bottom edge panel).
>
> --
> CALUM BENSON, Usability Engineer Sun Microsystems Ireland
> mailto:calum benson ireland sun com Desktop Engineering Group
> http://www.sun.ie +353 1 819 9771
>
> Any opinions are personal and not necessarily those of Sun Microsystems
> _______________________________________________
> gnome-accessibility-list mailing list
> gnome-accessibility-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-accessibility-list
cvs server: Diffing .
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/ChangeLog,v
retrieving revision 1.1744
diff -u -p -r1.1744 ChangeLog
--- ChangeLog 13 May 2002 23:47:28 -0000 1.1744
+++ ChangeLog 14 May 2002 08:14:55 -0000
@@ -1,3 +1,49 @@
+2002-05-14 Padraig O'Briain <padraig obriain sun com>
+
+ * panelrc:
+ rc file which ensures that SELECTED state for PanelWidget and its
+ children is not visible, by defaulta
+
+ * Makefile.am:
+ Update so that panelrc file is installed in $(datadir)/gnome-panel
+
+ * basep-widget.[ch]: foobar-widget.[ch]
+ Remove move-focus-out signal as moving focus from applet to PanelWidget
+ is not supported
+ Remove basep_key_press, default signal handler forkey_press_event
+
+ * button-widget.c:
+ (button_widget_expose) Highlight widget when it has focus
+ Draw focus indication using style's focus-line-width" and
+ "focus-padding"
+
+ * main.c (main):
+ Call gtk_rc_add_default_file () for panelrc. so PanelWidghet and applets
+ will show state SELECTED as NORMAL, by default
+
+ * panel-marshal.list:
+ Add BOOLEAN:VOID for new signal popup_panel_menu
+
+ * panel-widget.c:
+ Add new signal popup_panel_menu which pops up context menu for
+ PanelWidget; use Ctrl+F10 to activate the signal.
+ Remove function panel_widget_save_key_event()
+ Remove function panel_widget_focus() which was useed to implement
+ Remove function panel_widget_focus_in_event() and
+ panel_widget_focus_out_event()
+ Ctrl+Tab to move focus from applet to PanelWidget
+ (panel_widget_finalize): Remove reference to panel->key_event
+ (panel_widget_real_focus): Remove reference to panel->key_event
+ which supported giving focus to PanelWidget when focus was inside
+ an applet in another process. Remove CAN_FOCUS flag if PanelWidget
+ has children.
+
+ panel.c:
+ (panel_end_move) Do not give focus to PanelWidget on mouse click
+ (panel_widget_event): For key press, check whether focus widget is a
+ GtkSocket; if so, activate bindings
+ Set state to GTK_STATE_SELECTED for focus in.
+
2002-05-13 Seth Nickell <snickell stanford edu>
* foobar-widget.c: (append_actions_menu):
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/Makefile.am,v
retrieving revision 1.278
diff -u -p -r1.278 Makefile.am
--- Makefile.am 29 Apr 2002 20:30:09 -0000 1.278
+++ Makefile.am 14 May 2002 08:14:55 -0000
@@ -13,6 +13,7 @@ INCLUDES = \
-DPANEL_DEBUG \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGLADEDIR=\""$(datadir)/gnome/panel"\" \
+ -DPANELRC=\""$(rcdir)/$(rc_DATA)"\" \
$(DISABLE_DEPRECATED_CFLAGS) \
$(STANDARD_PROPERTIES_CFLAGS) \
$(ALLOW_CRACKPOT_MENU_CODE) \
@@ -214,7 +215,8 @@ EXTRA_DIST = \
nothing.h \
$(schema_DATA) \
$(ui_DATA) \
- panel-marshal.list
+ panel-marshal.list \
+ panelrc
sysdir = $(datadir)/control-center-2.0/capplets
sys_in_files = gnome-panel-preferences.desktop.in
@@ -272,6 +274,9 @@ schema_DATA = panel-global-config.schema
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_Panel.server.in
server_DATA = $(server_in_files:.server.in=.server)
+
+rcdir = $(datadir)/gnome-panel
+rc_DATA = panelrc
@INTLTOOL_SERVER_RULE@
Index: basep-widget.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/basep-widget.c,v
retrieving revision 1.169
diff -u -p -r1.169 basep-widget.c
--- basep-widget.c 22 Apr 2002 16:35:49 -0000 1.169
+++ basep-widget.c 14 May 2002 08:14:56 -0000
@@ -50,7 +50,6 @@ static void basep_pos_class_init (BasePP
static void basep_pos_instance_init (BasePPos *pos);
/* Forward declare some static functions for use in the class init */
-static void basep_widget_move_focus_out (BasePWidget *basep);
static void basep_widget_mode_change (BasePWidget *basep, BasePMode mode);
static void basep_widget_state_change (BasePWidget *basep, BasePState state);
static void basep_widget_real_screen_change (BasePWidget *basep, int screen);
@@ -60,7 +59,6 @@ static void basep_widget_realize (GtkWid
static void basep_widget_map (GtkWidget *w);
static gboolean basep_enter_notify (GtkWidget *widget, GdkEventCrossing *event);
static gboolean basep_leave_notify (GtkWidget *widget, GdkEventCrossing *event);
-static gboolean basep_key_press (GtkWidget *widget, GdkEventKey *event);
static void basep_style_set (GtkWidget *widget, GtkStyle *previous_style);
static void basep_widget_destroy (GtkObject *o);
@@ -127,11 +125,9 @@ basep_widget_class_init (BasePWidgetClas
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkBindingSet *binding_set;
basep_widget_parent_class = g_type_class_ref (gtk_window_get_type ());
- klass->move_focus_out = basep_widget_move_focus_out;
klass->mode_change = basep_widget_mode_change;
klass->state_change = basep_widget_state_change;
klass->screen_change = basep_widget_real_screen_change;
@@ -142,7 +138,6 @@ basep_widget_class_init (BasePWidgetClas
widget_class->map = basep_widget_map;
widget_class->enter_notify_event = basep_enter_notify;
widget_class->leave_notify_event = basep_leave_notify;
- widget_class->key_press_event = basep_key_press;
widget_class->style_set = basep_style_set;
gtk_object_class->destroy = basep_widget_destroy;
@@ -195,17 +190,6 @@ basep_widget_class_init (BasePWidgetClas
1,
PANEL_TYPE_OBJECT_TYPE); */
- basep_widget_signals[MOVE_FOCUS_OUT_SIGNAL] =
- g_signal_new ("move_focus_out",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (BasePWidgetClass, move_focus_out),
- NULL,
- NULL,
- panel_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
basep_widget_signals[MODE_CHANGE_SIGNAL] =
g_signal_new ("mode_change",
G_TYPE_FROM_CLASS (object_class),
@@ -241,14 +225,6 @@ basep_widget_class_init (BasePWidgetClas
G_TYPE_NONE,
1,
G_TYPE_INT);
-
- binding_set = gtk_binding_set_by_class (gtk_object_class);
- gtk_binding_entry_add_signal (binding_set,
- GDK_Tab, GDK_CONTROL_MASK,
- "move_focus_out", 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Tab, GDK_CONTROL_MASK,
- "move_focus_out", 0);
}
static void
@@ -556,26 +532,6 @@ basep_widget_size_allocate (GtkWidget *w
}
static void
-basep_widget_move_focus_out (BasePWidget *basep)
-{
- if (DRAWER_IS_WIDGET (basep)) {
- Drawer *drawer = g_object_get_data (G_OBJECT (basep),
- DRAWER_PANEL_KEY);
- PanelWidget *panel = PANEL_WIDGET (drawer->button->parent);
- GtkWidget *parent = panel->panel_parent;
-
- drawer_widget_close_drawer (DRAWER_WIDGET (basep), parent);
- drawer->moving_focus = TRUE;
- gtk_window_present (GTK_WINDOW (parent));
- gtk_widget_grab_focus (drawer->button);
- } else {
- PanelWidget *panel = PANEL_WIDGET (basep->panel);
-
- panel_widget_focus (panel);
- }
-}
-
-static void
basep_widget_mode_change (BasePWidget *basep, BasePMode old_mode)
{
if (BORDER_IS_WIDGET (basep))
@@ -824,24 +780,6 @@ basep_pos_instance_init (BasePPos *pos)
return;
}
-static gboolean
-basep_key_press (GtkWidget *widget, GdkEventKey *event)
-{
- BasePWidget *basep;
- PanelWidget *panel;
-
- g_return_val_if_fail (BASEP_IS_WIDGET (widget), FALSE);
-
- basep = BASEP_WIDGET (widget);
-
- g_return_val_if_fail (PANEL_IS_WIDGET (basep->panel), FALSE);
-
- panel = PANEL_WIDGET (basep->panel);
-
- panel_widget_save_key_event (panel, event);
- return GTK_WIDGET_CLASS (basep_widget_parent_class)->key_press_event (widget, event);
-}
-
static gboolean
basep_leave_notify (GtkWidget *widget,
GdkEventCrossing *event)
Index: basep-widget.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/basep-widget.h,v
retrieving revision 1.47
diff -u -p -r1.47 basep-widget.h
--- basep-widget.h 28 Feb 2002 07:49:39 -0000 1.47
+++ basep-widget.h 14 May 2002 08:14:56 -0000
@@ -106,8 +106,6 @@ struct _BasePWidgetClass
/*void (*type_change) (BasePWidget *basep,
PanelType type);*/
- void (* move_focus_out) (BasePWidget *basep);
-
void (* mode_change) (BasePWidget *basep,
BasePMode old_mode);
Index: button-widget.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/button-widget.c,v
retrieving revision 1.98
diff -u -p -r1.98 button-widget.c
--- button-widget.c 18 Apr 2002 08:08:06 -0000 1.98
+++ button-widget.c 14 May 2002 08:14:56 -0000
@@ -442,10 +442,10 @@ button_widget_expose (GtkWidget
off = (button->in_button && button->button_down) ?
SCALE(BUTTON_WIDGET_DISPLACEMENT) : 0;
- if (!global_config.highlight_when_over || !button->in_button) {
- pb = button_widget->scaled;
- } else {
+ if (global_config.highlight_when_over && (button->in_button || GTK_WIDGET_HAS_FOCUS (widget))) {
pb = button_widget->scaled_hc;
+ } else {
+ pb = button_widget->scaled;
}
w = gdk_pixbuf_get_width (pb);
@@ -493,13 +493,21 @@ button_widget_expose (GtkWidget
}
if (GTK_WIDGET_HAS_FOCUS (widget)) {
+ gint focus_width, focus_pad;
+ gint x, y, width, height;
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+ x = widget->allocation.x + focus_pad;
+ y = widget->allocation.y + focus_pad;
+ width = widget->allocation.width - (focus_width + 2 * focus_pad); focus_pad;
+ height = widget->allocation.height - (focus_width + 2 * focus_pad); focus_pad;
gtk_paint_focus (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
&event->area, widget, "button",
- widget->allocation.x + 1,
- widget->allocation.y + 1,
- widget->allocation.width - 3,
- widget->allocation.height - 3);
+ x, y, width, height);
}
return FALSE;
Index: foobar-widget.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/foobar-widget.c,v
retrieving revision 1.157
diff -u -p -r1.157 foobar-widget.c
--- foobar-widget.c 13 May 2002 23:47:29 -0000 1.157
+++ foobar-widget.c 14 May 2002 08:14:56 -0000
@@ -54,10 +54,6 @@ static gboolean foobar_leave_notify (Gtk
GdkEventCrossing *event);
static gboolean foobar_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
-static gboolean foobar_key_press (GtkWidget *widget,
- GdkEventKey *event);
-static void foobar_widget_move_focus_out (FoobarWidget *foo);
-static void foobar_widget_move_focus_out (FoobarWidget *foo);
static void append_task_menu (FoobarWidget *foo, GtkMenuShell *menu_bar);
static void setup_task_menu (FoobarWidget *foo);
@@ -103,7 +99,6 @@ foobar_widget_class_init (FoobarWidgetCl
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
- GtkBindingSet *binding_set;
object_class->destroy = foobar_widget_destroy;
@@ -111,9 +106,6 @@ foobar_widget_class_init (FoobarWidgetCl
widget_class->size_allocate = foobar_widget_size_allocate;
widget_class->enter_notify_event = foobar_enter_notify;
widget_class->leave_notify_event = foobar_leave_notify;
- widget_class->key_press_event = foobar_key_press;
-
- klass->move_focus_out = foobar_widget_move_focus_out;
gtk_rc_parse_string ("style \"panel-foobar-menubar-style\"\n"
"{\n"
@@ -121,44 +113,6 @@ foobar_widget_class_init (FoobarWidgetCl
"GtkMenuBar::internal-padding = 0\n"
"}\n"
"widget \"*.panel-foobar-menubar\" style \"panel-foobar-menubar-style\"");
-
- foobar_widget_signals[MOVE_FOCUS_OUT_SIGNAL] =
- g_signal_new ("move_focus_out",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (FoobarWidgetClass, move_focus_out),
- NULL, NULL,
- panel_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- binding_set = gtk_binding_set_by_class (object_class);
- gtk_binding_entry_add_signal (binding_set,
- GDK_Tab, GDK_CONTROL_MASK,
- "move_focus_out", 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Tab, GDK_CONTROL_MASK,
- "move_focus_out", 0);
-
-
-}
-
-static gboolean
-foobar_key_press (GtkWidget *widget, GdkEventKey *event)
-{
- FoobarWidget *foobar;
- PanelWidget *panel;
-
- g_return_val_if_fail (FOOBAR_IS_WIDGET (widget), FALSE);
-
- foobar = FOOBAR_WIDGET (widget);
-
- g_return_val_if_fail (PANEL_IS_WIDGET (foobar->panel), FALSE);
-
- panel = PANEL_WIDGET (foobar->panel);
-
- panel_widget_save_key_event (panel, event);
- return GTK_WIDGET_CLASS (foobar_widget_parent_class)->key_press_event (widget, event);
}
static gboolean
@@ -1033,10 +987,4 @@ foobar_widget_redo_window(FoobarWidget *
gtk_drag_dest_set (widget, 0, NULL, 0, 0);
gtk_widget_map(widget);
-}
-
-static void
-foobar_widget_move_focus_out (FoobarWidget *foobar)
-{
- panel_widget_focus (PANEL_WIDGET (foobar->panel));
}
Index: foobar-widget.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/foobar-widget.h,v
retrieving revision 1.30
diff -u -p -r1.30 foobar-widget.h
--- foobar-widget.h 29 Mar 2002 14:00:12 -0000 1.30
+++ foobar-widget.h 14 May 2002 08:14:56 -0000
@@ -52,8 +52,6 @@ struct _FoobarWidget
struct _FoobarWidgetClass
{
GtkWindowClass panel_class;
-
- void (*move_focus_out) (FoobarWidget *foo);
};
GType foobar_widget_get_type (void) G_GNUC_CONST;
Index: main.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/main.c,v
retrieving revision 1.324
diff -u -p -r1.324 main.c
--- main.c 18 Apr 2002 14:58:06 -0000 1.324
+++ main.c 14 May 2002 08:14:56 -0000
@@ -176,6 +176,8 @@ main(int argc, char **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+ gtk_rc_add_default_file (PANELRC);
+
gnome_program_init ("gnome-panel", VERSION,
LIBGNOMEUI_MODULE,
argc, argv,
Index: panel-marshal.list
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-marshal.list,v
retrieving revision 1.9
diff -u -p -r1.9 panel-marshal.list
--- panel-marshal.list 20 Mar 2002 19:43:21 -0000 1.9
+++ panel-marshal.list 14 May 2002 08:14:56 -0000
@@ -6,3 +6,4 @@ VOID:POINTER
VOID:VOID
VOID:BOOLEAN
VOID:INT,INT
+BOOLEAN:VOID
Index: panel-widget.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-widget.c,v
retrieving revision 1.327
diff -u -p -r1.327 panel-widget.c
--- panel-widget.c 10 May 2002 16:13:35 -0000 1.327
+++ panel-widget.c 14 May 2002 08:14:56 -0000
@@ -73,11 +73,6 @@ static void panel_widget_style_set
GtkStyle *previous_style);
static void panel_widget_realize (GtkWidget *widget);
-static gboolean panel_widget_focus_in_event (GtkWidget *widget,
- GdkEventFocus *event);
-static gboolean panel_widget_focus_out_event(GtkWidget *widget,
- GdkEventFocus *event);
-
static void panel_widget_push_move_applet (PanelWidget *panel,
GtkDirectionType dir);
static void panel_widget_switch_move_applet (PanelWidget *panel,
@@ -87,6 +82,7 @@ static void panel_widget_free_move_apple
static void panel_widget_tab_move (PanelWidget *panel,
gboolean next);
static void panel_widget_end_move (PanelWidget *panel);
+static gboolean panel_widget_popup_panel_menu (PanelWidget *panel);
static gboolean panel_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction);
@@ -178,6 +174,7 @@ enum {
FREE_MOVE_SIGNAL,
TAB_MOVE_SIGNAL,
END_MOVE_SIGNAL,
+ POPUP_PANEL_MENU_SIGNAL,
LAST_SIGNAL
};
@@ -320,6 +317,9 @@ panel_widget_class_init (PanelWidgetClas
GObjectClass *gobject_class = (GObjectClass*) class;
GtkWidgetClass *widget_class = (GtkWidgetClass*) class;
GtkContainerClass *container_class = (GtkContainerClass*) class;
+ GtkBindingSet *binding_set;
+
+ binding_set = gtk_binding_set_by_class (class);
panel_widget_signals[ORIENT_CHANGE_SIGNAL] =
g_signal_new ("orient_change",
@@ -466,6 +466,17 @@ panel_widget_class_init (PanelWidgetClas
G_TYPE_NONE,
0);
+ panel_widget_signals[POPUP_PANEL_MENU_SIGNAL] =
+ g_signal_new ("popup_panel_menu",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (PanelWidgetClass, popup_panel_menu),
+ NULL,
+ NULL,
+ panel_marshal_BOOLEAN__VOID,
+ G_TYPE_BOOLEAN,
+ 0);
+
class->orient_change = NULL;
class->size_change = NULL;
class->applet_move = NULL;
@@ -478,6 +489,7 @@ panel_widget_class_init (PanelWidgetClas
class->free_move = panel_widget_free_move_applet;
class->tab_move = panel_widget_tab_move;
class->end_move = panel_widget_end_move;
+ class->popup_panel_menu = panel_widget_popup_panel_menu;
object_class->destroy = panel_widget_destroy;
gobject_class->finalize = panel_widget_finalize;
@@ -487,12 +499,13 @@ panel_widget_class_init (PanelWidgetClas
widget_class->realize = panel_widget_realize;
widget_class->expose_event = panel_widget_expose;
widget_class->style_set = panel_widget_style_set;
- widget_class->focus_in_event = panel_widget_focus_in_event;
- widget_class->focus_out_event = panel_widget_focus_out_event;
widget_class->focus = panel_widget_real_focus;
container_class->add = panel_widget_cadd;
container_class->remove = panel_widget_cremove;
+
+ gtk_binding_entry_add_signal (binding_set, GDK_F10, GDK_CONTROL_MASK,
+ "popup_panel_menu", 0);
}
static void
@@ -1715,9 +1728,6 @@ panel_widget_finalize (GObject *obj)
g_free (panel->unique_id);
panel->unique_id = NULL;
- if (panel->key_event)
- gdk_event_free ((GdkEvent *)panel->key_event);
-
if (G_OBJECT_CLASS (panel_widget_parent_class)->finalize)
G_OBJECT_CLASS (panel_widget_parent_class)->finalize (obj);
}
@@ -2950,69 +2960,15 @@ panel_widget_end_move (PanelWidget *pane
}
static gboolean
-panel_widget_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
-{
- /*
- * FIXME: we need to figure out something sensible
- * to do to indicate focus
- */
-
- GTK_WIDGET_CLASS (panel_widget_parent_class)->focus_in_event (widget, event);
-
- return FALSE;
-}
-
-static gboolean
-panel_widget_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
-{
- PanelWidget *panel_widget = PANEL_WIDGET (widget);
-
- if (GTK_WINDOW (panel_widget->panel_parent)->has_focus)
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
-
- GTK_WIDGET_CLASS (panel_widget_parent_class)->focus_out_event (widget, event);
-
- return FALSE;
-}
-
-static gboolean
panel_widget_real_focus (GtkWidget *widget,
GtkDirectionType direction)
{
- PanelWidget *panel = PANEL_WIDGET (widget);
-
- if (panel->key_event) {
- if (panel->key_event->state & GDK_CONTROL_MASK) {
- /*
- * Ctrl+Tab was pressed when focus was in applet in
- * another process
- */
- panel_widget_focus (PANEL_WIDGET (widget));
- return TRUE;
- }
- }
-
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
+ if (GTK_WIDGET_HAS_FOCUS (widget) && GTK_FIXED (widget)->children) {
GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
}
return GTK_WIDGET_CLASS (panel_widget_parent_class)->focus (widget, direction);
}
-void panel_widget_focus (PanelWidget *panel)
-{
- /*
- * Set the focus back on the panel; we unset the focus child so that
- * the next time focus is inside the panel we do not remember the
- * previously focused child. We also need to set GTK_CAN_FOCUS flag
- * on the panel as it is unset when this function is called.
- */
- if (!DRAWER_IS_WIDGET (panel->panel_parent)) {
- gtk_container_set_focus_child (GTK_CONTAINER (panel), NULL);
- GTK_WIDGET_SET_FLAGS (panel, GTK_CAN_FOCUS);
- gtk_widget_grab_focus (GTK_WIDGET (panel));
- }
-}
-
PanelOrient
panel_widget_get_applet_orient (PanelWidget *panel)
{
@@ -3025,13 +2981,11 @@ panel_widget_get_applet_orient (PanelWid
return basep_widget_get_applet_orient (BASEP_WIDGET (panel->panel_parent));
}
-void
-panel_widget_save_key_event (PanelWidget *panel,
- GdkEventKey *key_event)
+static gboolean
+panel_widget_popup_panel_menu (PanelWidget *panel)
{
- if (panel->key_event) {
- gdk_event_free ((GdkEvent *)panel->key_event);
- }
- panel->key_event = (GdkEventKey *) gdk_event_copy ((GdkEvent *)key_event);
-}
+ gboolean ret_val;
+ g_signal_emit_by_name (panel, "popup_menu", &ret_val);
+ return ret_val;
+}
Index: panel-widget.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel-widget.h,v
retrieving revision 1.138
diff -u -p -r1.138 panel-widget.h
--- panel-widget.h 17 Apr 2002 12:52:59 -0000 1.138
+++ panel-widget.h 14 May 2002 08:14:56 -0000
@@ -107,7 +107,6 @@ struct _PanelWidget
was set, this is used
for tiling onto the
background */
- GdkEventKey *key_event;
};
struct _PanelWidgetClass
@@ -139,6 +138,7 @@ struct _PanelWidgetClass
void (* tab_move) (PanelWidget *panel,
gboolean next);
void (* end_move) (PanelWidget *panel);
+ gboolean (* popup_panel_menu) (PanelWidget *panel);
};
Index: panel.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/panel.c,v
retrieving revision 1.468
diff -u -p -r1.468 panel.c
--- panel.c 18 Apr 2002 13:43:39 -0000 1.468
+++ panel.c 14 May 2002 08:14:57 -0000
@@ -808,9 +808,6 @@ panel_end_move (GtkWidget *widget, GdkEv
g_source_remove (panel_dragged_timeout);
panel_dragged_timeout = 0;
panel_been_moved = FALSE;
- if (pointer_in_widget (basep->panel, bevent) &&
- ! gtk_widget_is_focus (basep->panel))
- panel_widget_focus (PANEL_WIDGET (basep->panel));
/* FIXME: why is this neccessary!!!!???? */
gtk_container_foreach (GTK_CONTAINER (basep->panel),
@@ -829,6 +826,9 @@ panel_event(GtkWidget *widget, GdkEvent
PanelWidget *panel = NULL;
BasePWidget *basep = NULL;
GdkEventButton *bevent;
+ GdkEventKey *kevent;
+ GdkEventFocus *fevent;
+ GtkStateType state;
int x, y;
if (BASEP_IS_WIDGET (widget)) {
@@ -884,6 +884,22 @@ panel_event(GtkWidget *widget, GdkEvent
}
}
break;
+ case GDK_KEY_PRESS:
+ kevent = (GdkEventKey *)event;
+ if (GTK_IS_SOCKET (GTK_WINDOW (widget)->focus_widget)) {
+ /*
+ * If the focus widget is a GtkSocket, i.e. the
+ * focus is in an applet in another widget, then key
+ * bindings do not work. We get around this by
+ * activating the key bindings here.
+ */
+ return gtk_bindings_activate (GTK_OBJECT (panel), kevent->keyval, kevent->state);
+ }
+ break;
+ case GDK_FOCUS_CHANGE:
+ fevent = (GdkEventFocus *)event;
+ state = (fevent->in) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL;
+ gtk_widget_set_state (GTK_WIDGET (panel), state);
default:
break;
Index: panelrc
===================================================================
RCS file: panelrc
diff -N panelrc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ panelrc 14 May 2002 08:14:57 -0000
@@ -0,0 +1,8 @@
+style "panel-style"
+{
+ fg[SELECTED] = { 0, 0, 0 }
+ bg[SELECTED] = { 0xd6d6, 0xd6d6, 0xd6d6 }
+}
+
+widget "*PanelWidget*" style : application "panel-style"
+widget "*PanelApplet*" style : application "panel-style"
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/libpanel-applet/ChangeLog,v
retrieving revision 1.62
diff -u -p -r1.62 ChangeLog
--- ChangeLog 13 May 2002 12:30:33 -0000 1.62
+++ ChangeLog 14 May 2002 08:18:35 -0000
@@ -1,3 +1,18 @@
+2002-05-14 Padraig O'Briain <padraig obriain sun com>
+
+ * Makefile.am:
+ Add definiition for PANELRC
+
+ * panel-applet.c
+ Add function panel_applet_add_default_rcfile()
+ (panel_applet_expose): Use style's focus-line-width and
+ focus-padding when drawing focus indicator.
+
+ * panel-applet.h:
+ Add call to panel_applet_add_default_rcfile() to
+ PANEL_APPLET_BONOBO_FACTORY macro so applets will show SELECTED state
+ as NORMAL, by default.
+
2002-05-13 Arvind Samptur <arvind samptur wipro com>
* panel-applet.c: (panel_applet_button_press)
stopped the propogation of the left click on applet
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-panel/libpanel-applet/Makefile.am,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.am
--- Makefile.am 21 Mar 2002 13:48:08 -0000 1.12
+++ Makefile.am 14 May 2002 08:18:35 -0000
@@ -13,6 +13,7 @@ INCLUDES = \
-DPANEL_APPLET_DATADIR=\""$(datadir)"\" \
-DPANEL_APPLET_GLADEDIR=\""$(gladedir)"\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+ -DPANELRC=\""$(datadir)/gnome-panel/panelrc"\" \
$(LIBPANEL_APPLET_CFLAGS) \
$(WARN_CFLAGS)
Index: panel-applet.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-applet.c,v
retrieving revision 1.56
diff -u -p -r1.56 panel-applet.c
--- panel-applet.c 13 May 2002 12:30:33 -0000 1.56
+++ panel-applet.c 14 May 2002 08:18:35 -0000
@@ -489,15 +489,24 @@ panel_applet_expose (GtkWidget *wid
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
- if (GTK_WIDGET_HAS_FOCUS (widget))
+ if (GTK_WIDGET_HAS_FOCUS (widget)) {
+ gint focus_width, focus_pad;
+ gint x, y, width, height;
+
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
+ x = widget->allocation.x;
+ y = widget->allocation.y;
+ width = widget->allocation.width - (focus_width + focus_pad);
+ height = widget->allocation.height - (focus_width + focus_pad);
+
gtk_paint_focus (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
&event->area, widget, "panel_applet",
- widget->allocation.x + 1,
- widget->allocation.y + 1,
- widget->allocation.width - 3,
- widget->allocation.height - 3);
-
+ x, y, width, height);
+ }
return FALSE;
}
@@ -1484,4 +1493,10 @@ panel_applet_shlib_factory (const char
g_cclosure_new (G_CALLBACK (callback),
user_data, NULL),
ev);
+}
+
+void
+panel_applet_add_default_rcfile (void)
+{
+ gtk_rc_add_default_file (PANELRC);
}
Index: panel-applet.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/libpanel-applet/panel-applet.h,v
retrieving revision 1.32
diff -u -p -r1.32 panel-applet.h
--- panel-applet.h 17 Apr 2002 14:12:50 -0000 1.32
+++ panel-applet.h 14 May 2002 08:18:35 -0000
@@ -165,6 +165,8 @@ Bonobo_Unknown panel_applet_shlib_fac
GClosure *closure,
CORBA_Environment *ev);
+void panel_applet_add_default_rcfile (void);
+
/*
* These macros are getting a bit unwieldy.
*
@@ -180,6 +182,7 @@ int main (int argc, char *argv [])
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \
textdomain (GETTEXT_PACKAGE); \
+ panel_applet_add_default_rcfile (); \
gnome_program_init (name, version, \
LIBGNOMEUI_MODULE, \
argc, argv, \
@@ -194,6 +197,7 @@ int main (int argc, char *argv [])
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); \
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \
textdomain (GETTEXT_PACKAGE); \
+ panel_applet_add_default_rcfile (); \
gnome_program_init (name, version, \
LIBGNOMEUI_MODULE, \
argc, argv, \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]