Commit 7f5f1c8d authored by Jim Krehl's avatar Jim Krehl

committed from wrong WC on 2007-05-01

svn path=/branches/SLED10-SP1/; revision=267
parent c4c8279d
......@@ -158,20 +158,21 @@ static void setup_file_tables (MainMenuUI *);
static void setup_bookmark_agents (MainMenuUI *);
static void setup_lock_down (MainMenuUI *);
static void select_page (MainMenuUI *);
static void update_limits (MainMenuUI *);
static void connect_to_tile_triggers (MainMenuUI *, TileTable *);
static void hide_slab_if_urgent_close (MainMenuUI *);
static void set_search_section_visible (MainMenuUI *);
static void set_table_section_visible (MainMenuUI *, TileTable *);
static gchar **get_search_argv (const gchar *);
static void reorient_panel_button (MainMenuUI *);
static void bind_beagle_search_key (MainMenuUI *);
static void launch_search (MainMenuUI *);
static void grab_pointer_and_keyboard (MainMenuUI *, guint32);
static void ungrab_pointer_and_keyboard (MainMenuUI *, guint32);
static void apply_lockdown_settings (MainMenuUI *);
static gboolean app_is_in_blacklist (const gchar *);
static void select_page (MainMenuUI *);
static void update_limits (MainMenuUI *);
static void connect_to_tile_triggers (MainMenuUI *, TileTable *);
static void hide_slab_if_urgent_close (MainMenuUI *);
static void set_search_section_visible (MainMenuUI *);
static void set_table_section_visible (MainMenuUI *, TileTable *);
static gchar **get_search_argv (const gchar *);
static void reorient_panel_button (MainMenuUI *);
static void bind_beagle_search_key (MainMenuUI *);
static void launch_search (MainMenuUI *);
static void grab_pointer_and_keyboard (MainMenuUI *, guint32);
static void apply_lockdown_settings (MainMenuUI *);
static gboolean app_is_in_blacklist (const gchar *);
static void toggle_panel_button (MainMenuUI *);
static void handle_panel_button_button_press (MainMenuUI *, guint64);
static Tile *item_to_user_app_tile (BookmarkItem *, gpointer);
static Tile *item_to_recent_app_tile (BookmarkItem *, gpointer);
......@@ -182,10 +183,8 @@ static Tile *item_to_system_tile (BookmarkItem *, gpointer);
static BookmarkItem *app_uri_to_item (const gchar *, gpointer);
static BookmarkItem *doc_uri_to_item (const gchar *, gpointer);
static void panel_button_clicked_cb (GtkButton *, gpointer);
static void panel_button_toggled_cb (GtkToggleButton *, gpointer);
static gboolean panel_button_button_press_cb (GtkWidget *, GdkEventButton *, gpointer);
static gboolean panel_button_button_release_cb (GtkWidget *, GdkEventButton *, gpointer);
static gboolean panel_button_enter_notify_cb (GtkWidget *, GdkEventCrossing *, gpointer);
static void panel_button_drag_data_rcv_cb (GtkWidget *, GdkDragContext *, gint, gint,
GtkSelectionData *, guint, guint, gpointer);
static gboolean slab_window_expose_cb (GtkWidget *, GdkEventExpose *, gpointer);
......@@ -193,7 +192,6 @@ static gboolean slab_window_key_press_cb (GtkWidget *, GdkEventKey *, g
static gboolean slab_window_button_press_cb (GtkWidget *, GdkEventButton *, gpointer);
static void slab_window_allocate_cb (GtkWidget *, GtkAllocation *, gpointer);
static void slab_window_map_event_cb (GtkWidget *, GdkEvent *, gpointer);
static gboolean slab_window_enter_notify_cb (GtkWidget *, GdkEventCrossing *, gpointer);
static void slab_window_unmap_event_cb (GtkWidget *, GdkEvent *, gpointer);
static gboolean slab_window_grab_broken_cb (GtkWidget *, GdkEvent *, gpointer);
static void search_entry_activate_cb (GtkEntry *, gpointer);
......@@ -485,21 +483,13 @@ create_panel_button (MainMenuUI *this)
GTK_CONTAINER (button_parent), GTK_WIDGET (priv->panel_buttons [i]));
g_signal_connect (
G_OBJECT (priv->panel_buttons [i]), "clicked",
G_CALLBACK (panel_button_clicked_cb), this);
G_OBJECT (priv->panel_buttons [i]), "toggled",
G_CALLBACK (panel_button_toggled_cb), this);
g_signal_connect (
G_OBJECT (priv->panel_buttons [i]), "button_press_event",
G_CALLBACK (panel_button_button_press_cb), this);
g_signal_connect (
G_OBJECT (priv->panel_buttons [i]), "button_release_event",
G_CALLBACK (panel_button_button_release_cb), this);
g_signal_connect (
G_OBJECT (priv->panel_buttons [i]), "enter_notify_event",
G_CALLBACK (panel_button_enter_notify_cb), this);
gtk_drag_dest_set (
GTK_WIDGET (priv->panel_buttons [i]),
GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_COPY | GDK_ACTION_MOVE);
......@@ -579,10 +569,6 @@ create_slab_window (MainMenuUI *this)
G_OBJECT (priv->slab_window), "map-event",
G_CALLBACK (slab_window_map_event_cb), this);
g_signal_connect (
G_OBJECT (priv->slab_window), "enter_notify_event",
G_CALLBACK (slab_window_enter_notify_cb), this);
g_signal_connect (
G_OBJECT (priv->slab_window), "unmap-event",
G_CALLBACK (slab_window_unmap_event_cb), this);
......@@ -1128,6 +1114,34 @@ app_is_in_blacklist (const gchar *uri)
return blacklisted;
}
static void
toggle_panel_button (MainMenuUI *this)
{
MainMenuUIPrivate *priv = PRIVATE (this);
gboolean active = gtk_toggle_button_get_active (priv->panel_button);
gtk_toggle_button_set_active (priv->panel_button, ! active);
}
static void
handle_panel_button_button_press (MainMenuUI *this, guint64 time)
{
MainMenuUIPrivate *priv = PRIVATE (this);
DoubleClickDetector *dcd;
gboolean is_dc;
dcd = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (priv->panel_button),
"double-click-detector"));
is_dc = double_click_detector_is_double_click (dcd, time, TRUE);
if (! is_dc)
toggle_panel_button (this);
}
static void
select_page (MainMenuUI *this)
{
......@@ -1443,20 +1457,22 @@ grab_pointer_and_keyboard (MainMenuUI *this, guint32 time)
GdkGrabStatus status;
if (time == 0)
time = GDK_CURRENT_TIME;
if (GPOINTER_TO_INT (libslab_get_gconf_value (URGENT_CLOSE_GCONF_KEY))) {
if (! priv->ptr_is_grabbed) {
status = gdk_pointer_grab (
priv->slab_window->window, TRUE, GDK_BUTTON_PRESS_MASK,
NULL, NULL, time);
gtk_widget_grab_focus (priv->slab_window);
gtk_grab_add (priv->slab_window);
priv->ptr_is_grabbed = (status == GDK_GRAB_SUCCESS);
}
status = gdk_pointer_grab (
priv->slab_window->window, TRUE, GDK_BUTTON_PRESS_MASK,
NULL, NULL, time);
if (! priv->kbd_is_grabbed) {
status = gdk_keyboard_grab (priv->slab_window->window, TRUE, time);
priv->ptr_is_grabbed = (status == GDK_GRAB_SUCCESS);
priv->kbd_is_grabbed = (status == GDK_GRAB_SUCCESS);
}
status = gdk_keyboard_grab (priv->slab_window->window, TRUE, time);
priv->kbd_is_grabbed = (status == GDK_GRAB_SUCCESS);
}
else {
if (priv->ptr_is_grabbed) {
......@@ -1468,22 +1484,8 @@ grab_pointer_and_keyboard (MainMenuUI *this, guint32 time)
gdk_keyboard_ungrab (time);
priv->kbd_is_grabbed = FALSE;
}
}
}
static void
ungrab_pointer_and_keyboard (MainMenuUI *this, guint32 time)
{
MainMenuUIPrivate *priv = PRIVATE (this);
if (priv->ptr_is_grabbed) {
gdk_pointer_ungrab (time);
priv->ptr_is_grabbed = FALSE;
}
if (priv->kbd_is_grabbed) {
gdk_keyboard_ungrab (time);
priv->kbd_is_grabbed = FALSE;
gtk_grab_remove (priv->slab_window);
}
}
......@@ -1625,70 +1627,31 @@ exit:
}
static void
panel_button_clicked_cb (GtkButton *button, gpointer user_data)
panel_button_toggled_cb (GtkToggleButton *toggle, gpointer user_data)
{
MainMenuUIPrivate *priv = PRIVATE (user_data);
g_printf ("%s: slab visible = %d\n", G_STRFUNC, GTK_WIDGET_VISIBLE (priv->slab_window));
if (GTK_WIDGET_VISIBLE (priv->slab_window))
gtk_widget_hide (priv->slab_window);
else
if (! GTK_WIDGET_VISIBLE (priv->slab_window))
gtk_window_present_with_time (
GTK_WINDOW (priv->slab_window), gtk_get_current_event_time ());
else
gtk_widget_hide (priv->slab_window);
}
static gboolean
panel_button_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
MainMenuUIPrivate *priv = PRIVATE (user_data);
DoubleClickDetector *dcd;
gboolean is_dc;
g_printf ("%s: event->button = %d\n", G_STRFUNC, event->button);
if (event->button != 1)
g_signal_stop_emission_by_name (widget, "button_press_event");
else {
dcd = DOUBLE_CLICK_DETECTOR (
g_object_get_data (G_OBJECT (widget), "double-click-detector"));
is_dc = double_click_detector_is_double_click (dcd, gtk_get_current_event_time (), TRUE);
g_printf ("%s: is_dc = %d\n", G_STRFUNC, is_dc);
handle_panel_button_button_press (MAIN_MENU_UI (user_data), event->time);
if (is_dc)
g_signal_stop_emission_by_name (widget, "button_press_event");
else
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (widget), ! GTK_WIDGET_VISIBLE (priv->slab_window));
return TRUE;
}
return FALSE;
}
static gboolean
panel_button_button_release_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
g_printf ("%s: event->button = %d\n", G_STRFUNC, event->button);
if (event->button == 1)
g_signal_stop_emission_by_name (widget, "button_release_event");
return FALSE;
}
static gboolean
panel_button_enter_notify_cb (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
{
g_printf ("%s\n", G_STRFUNC);
ungrab_pointer_and_keyboard (MAIN_MENU_UI (user_data), event->time);
return FALSE;
}
static void
panel_button_drag_data_rcv_cb (GtkWidget *widget, GdkDragContext *context, gint x, gint y,
GtkSelectionData *selection, guint info, guint time,
......@@ -1882,19 +1845,29 @@ slab_window_button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer
MainMenuUI *this = MAIN_MENU_UI (user_data);
MainMenuUIPrivate *priv = PRIVATE (this);
GdkWindow *ptr_window;
GdkWindow *ptr_window = NULL;
gpointer window_widget = NULL;
ptr_window = gdk_window_at_pointer (NULL, NULL);
g_printf ("%s: ptr_window = %p, slab_window = %p, panel_button_window = %p\n", G_STRFUNC, ptr_window, priv->slab_window->window, GTK_WIDGET (priv->panel_button)->window);
if (ptr_window)
gdk_window_get_user_data (ptr_window, & window_widget);
if (priv->slab_window->window != ptr_window) {
if (priv->slab_window->window != ptr_window && window_widget != priv->panel_button) {
hide_slab_if_urgent_close (this);
return TRUE;
}
if (window_widget == priv->panel_button) {
g_signal_stop_emission_by_name (widget, "button_press_event");
handle_panel_button_button_press (this, event->time);
return TRUE;
}
return FALSE;
}
......@@ -1972,27 +1945,25 @@ slab_window_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_
static void
slab_window_map_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
g_printf ("%s\n", G_STRFUNC);
/* grab_pointer_and_keyboard (MAIN_MENU_UI (user_data), gdk_event_get_time (event)); */
}
static gboolean
slab_window_enter_notify_cb (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data)
{
g_printf ("%s\n", G_STRFUNC);
grab_pointer_and_keyboard (MAIN_MENU_UI (user_data), event->time);
return FALSE;
grab_pointer_and_keyboard (MAIN_MENU_UI (user_data), gdk_event_get_time (event));
}
static void
slab_window_unmap_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
g_printf ("%s\n", G_STRFUNC);
MainMenuUIPrivate *priv = PRIVATE (user_data);
if (priv->ptr_is_grabbed) {
gdk_pointer_ungrab (gdk_event_get_time (event));
priv->ptr_is_grabbed = FALSE;
}
if (priv->kbd_is_grabbed) {
gdk_keyboard_ungrab (gdk_event_get_time (event));
priv->kbd_is_grabbed = FALSE;
}
ungrab_pointer_and_keyboard (MAIN_MENU_UI (user_data), gdk_event_get_time (event));
gtk_grab_remove (widget);
}
static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment