[maemo-commits] [maemo-commits] r8581 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildonwm test
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Dec 4 16:09:56 EET 2006
- Previous message: [maemo-commits] r8580 - projects/haf/tags/hildon-fm
- Next message: [maemo-commits] r8582 - in projects/haf/trunk/hildon-theme-tools: . debian src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: moimart Date: 2006-12-04 16:09:54 +0200 (Mon, 04 Dec 2006) New Revision: 8581 Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-keys.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h projects/haf/branches/maemo-af-desktop/hildon-desktop/test/test4.c Log: * libhildonwm/hd-keys.c: Fixed shortcuts to active tn/ap buttons. * libhildonwm/hd-wm.[ch]: - Added method to have a reference of others menu. - Now hd-wm is able to focus any gtkwindow (and subclasses). * test/test4.c updated. * ChangeLog updated. Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-12-04 14:05:03 UTC (rev 8580) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-12-04 14:09:54 UTC (rev 8581) @@ -1,3 +1,10 @@ +2005-12-04 Moises Martinez <moises.martinzes at nokia.com> + + * libhildonwm/hd-keys.c: Fixed shortcuts to active tn/ap buttons. + * libhildonwm/hd-wm.[ch]: + - Added method to have a reference of others menu. + - Now hd-wm is able to focus any gtkwindow (and subclasses). + 2006-12-01 Lucas Rocha <lucas.rocha at nokia.com> * hd-desktop.c: keep track of container plugin directory changes and Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-keys.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-keys.c 2006-12-04 14:05:03 UTC (rev 8580) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-keys.c 2006-12-04 14:09:54 UTC (rev 8581) @@ -154,9 +154,9 @@ { HD_KEYS_GCONF_PATH "/window_minimize", HD_KEY_ACTION_MINIMIZE , hd_keys_action_minimize, NULL}, { HD_KEYS_GCONF_PATH "/task_switcher", HD_KEY_ACTION_TASK_SWITCHER, - hd_keys_action_tn_activate, GINT_TO_POINTER (0) }, /* AS MENU */ + hd_keys_action_tn_activate, GINT_TO_POINTER (HD_TN_ACTIVATE_MAIN_MENU) }, /* AS MENU */ { HD_KEYS_GCONF_PATH "/task_launcher", HD_KEY_ACTION_TASK_LAUNCHER, - hd_keys_action_tn_activate, GINT_TO_POINTER (0)}, /* OTHERS MENU */ + hd_keys_action_tn_activate, GINT_TO_POINTER (HD_TN_ACTIVATE_OTHERS_MENU)}, /* OTHERS MENU */ { HD_KEYS_GCONF_PATH "/power", HD_KEY_ACTION_POWER, hd_keys_action_power, GINT_TO_POINTER(FALSE) }, { HD_KEYS_GCONF_PATH "/home", HD_KEY_ACTION_HOME, @@ -182,19 +182,16 @@ XDisplayKeycodes (GDK_DISPLAY(), &min_kc, &max_kc); for (keycode = min_kc; keycode <= max_kc; keycode++) + { + for (col = 0; (k = XKeycodeToKeysym (GDK_DISPLAY(), keycode, col)) != NoSymbol; col++) { - for (col = 0; - (k = XKeycodeToKeysym (GDK_DISPLAY(), keycode, col)) != NoSymbol; - col++) - { - if (k == keysym && col == 1) - return TRUE; + if (k == keysym && col == 1) + return TRUE; - if (k == keysym) - break; - } - - } + if (k == keysym) + break; + } + } return FALSE; } Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c 2006-12-04 14:05:03 UTC (rev 8580) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.c 2006-12-04 14:09:54 UTC (rev 8581) @@ -143,6 +143,8 @@ GList *app_switchers; + GtkWidget *others_menu; + /* stack for the launch banner messages. * Needed to work round gtk(hindon)_infoprint issues. */ @@ -1510,6 +1512,28 @@ XFree(xwins.wins); } +static void +hd_wm_set_window_focus (GtkWindow *window, gboolean focus) +{ + g_assert (window && GTK_IS_WINDOW (window)); + + gtk_window_set_accept_focus (window, focus); + + if (focus) + gtk_window_present (window); + else + gtk_window_set_focus (window, NULL); +} + +void +hd_wm_set_others_menu_button (HDWM *hdwm, GtkWidget *widget) +{ + g_assert (hdwm && widget); + g_assert (HD_IS_WM (hdwm) && GTK_IS_WIDGET (widget)); + + hdwm->priv->others_menu = widget; +} + gboolean hd_wm_add_watched_window (HDWMWatchedWindow *win) { @@ -1603,7 +1627,7 @@ } void -hd_wm_activate(guint32 what) +hd_wm_activate_window (guint32 what, GtkWindow *window) { /*GtkWidget * button = NULL;*/ HDWM *hdwm = hd_wm_get_singleton (); @@ -1611,55 +1635,38 @@ g_debug ("received request %d", what); if (what >= (int) HD_TN_ACTIVATE_LAST) - { - g_critical("Invalid value passed to hd_wm_activate()"); - return; - } + { + g_critical("Invalid value passed to hd_wm_activate()"); + return; + } switch (what) - { - case HD_TN_ACTIVATE_KEY_FOCUS: - g_debug ("Making TN focusable"); - hdwm->priv->has_focus = TRUE; - - g_debug ("%s: %d, set focus to tn to true",__FILE__,__LINE__); - /*hn_window_set_focus (tasknav,TRUE);*/ - return; - - case HD_TN_DEACTIVATE_KEY_FOCUS: - g_debug ("Making TN unfocusable"); - hdwm->priv->has_focus = FALSE; - - g_debug ("%s: %d, set focus to tn to false",__FILE__,__LINE__); - /*hn_window_set_focus (tasknav,FALSE);*/ - return; - - case HD_TN_ACTIVATE_MAIN_MENU: - g_debug ("activating main menu"); - - g_debug ("%s: %d, hn_app_switcher_toggle_menu_button (hdwm->priv->app_switcher);",__FILE__,__LINE__); - - return; - - case HD_TN_ACTIVATE_LAST_APP_WINDOW: - g_debug ("passing focus to last active window"); - hdwm->priv->has_focus = FALSE; - hd_wm_focus_active_window (hdwm); - return; - - default: - - g_debug ("%s: %d, try to activate button in tasknav",__FILE__,__LINE__); - /* - button = hn_window_get_button_focus (tasknav,what); - if(button) - { - g_debug ("activating some other button"); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); - g_signal_emit_by_name(button, "toggled"); - } - */ - } + { + case HD_TN_ACTIVATE_KEY_FOCUS: + hdwm->priv->has_focus = TRUE; + if (window) + hd_wm_set_window_focus (window,TRUE); + return; + case HD_TN_DEACTIVATE_KEY_FOCUS: + hdwm->priv->has_focus = FALSE; + if (window) + hd_wm_set_window_focus (window,FALSE); + return; + case HD_TN_ACTIVATE_MAIN_MENU: + g_debug ("activating main menu: signal"); + g_debug ("%s: %d, hn_app_switcher_toggle_menu_button (hdwm->priv->app_switcher);",__FILE__,__LINE__); + return; + case HD_TN_ACTIVATE_LAST_APP_WINDOW: + hdwm->priv->has_focus = FALSE; + hd_wm_focus_active_window (hdwm); + return; + case HD_TN_ACTIVATE_OTHERS_MENU: + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (hdwm->priv->others_menu), TRUE); + g_signal_emit_by_name (hdwm->priv->others_menu, "toggled"); + break; + default: + g_debug ("%s: %d, hd_wm_activate: deprecated. It was used to activate specific tasknavigator buttons",__FILE__,__LINE__); + } } static gboolean Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h 2006-12-04 14:05:03 UTC (rev 8580) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildonwm/hd-wm.h 2006-12-04 14:09:54 UTC (rev 8581) @@ -219,11 +219,16 @@ /* keyboard handling functions */ void -hd_wm_activate(guint32 what); +hd_wm_activate_window (guint32 what, GtkWindow *window); +#define hd_wm_activate(what) hd_wm_activate_window (what,NULL) + void hd_wm_focus_active_window (HDWM *hdwm); +void +hd_wm_set_others_menu_button (HDWM *hdwm, GtkWidget *widget); + gboolean hd_wm_fullscreen_mode (void); Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/test/test4.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/test/test4.c 2006-12-04 14:05:03 UTC (rev 8580) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/test/test4.c 2006-12-04 14:09:54 UTC (rev 8581) @@ -1,38 +1,20 @@ +#include <libhildondesktop/hn-app-switcher.h> #include <libhildonwm/hd-wm.h> -void -generic_callback (HDWM *hdwm, HDEntryInfo *info, gpointer data) -{ - g_debug ("ACTION: %s app name: %s",data,hd_entry_info_get_title (info)); -} - int main (int argc, char **argv) { + GtkWidget *win; + gtk_init (&argc,&argv); HDWM *wm = hd_wm_get_singleton (); - g_signal_connect (G_OBJECT (wm), - "entry_info_changed", - G_CALLBACK (generic_callback), - g_strdup ("info changed")); - - g_signal_connect (G_OBJECT (wm), - "entry_info_added", - G_CALLBACK (generic_callback), - g_strdup ("info added")); - - g_signal_connect (G_OBJECT (wm), - "entry_info_stack_changed", - G_CALLBACK (generic_callback), - g_strdup ("stack changed")); - - g_signal_connect (G_OBJECT (wm), - "entry_info_removed", - G_CALLBACK (generic_callback), - g_strdup ("info removed")); - + win = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_type_hint (GTK_WINDOW (win), GDK_WINDOW_TYPE_HINT_DESKTOP); + gtk_container_add (GTK_CONTAINER (win), hn_app_switcher_new ()); + gtk_widget_show_all (win); + gtk_main (); return 0;
- Previous message: [maemo-commits] r8580 - projects/haf/tags/hildon-fm
- Next message: [maemo-commits] r8582 - in projects/haf/trunk/hildon-theme-tools: . debian src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]