summaryrefslogtreecommitdiff
diff options
-rw-r--r--src/BamfLauncherIcon.cpp46
-rw-r--r--src/BamfLauncherIcon.h5
-rw-r--r--src/DeviceLauncherSection.cpp7
-rw-r--r--src/DeviceLauncherSection.h1
-rw-r--r--src/Launcher.cpp210
-rw-r--r--src/Launcher.h19
-rw-r--r--src/LauncherController.cpp2
-rw-r--r--src/LauncherDragWindow.cpp2
-rw-r--r--src/LauncherHideMachine.cpp34
-rw-r--r--src/LauncherHideMachine.h5
-rw-r--r--src/LauncherHoverMachine.cpp22
-rw-r--r--src/LauncherHoverMachine.h4
-rw-r--r--src/LauncherIcon.cpp4
-rw-r--r--src/PanelHomeButton.cpp2
-rw-r--r--src/PanelIndicatorObjectEntryView.cpp2
-rw-r--r--src/PanelMenuView.cpp8
-rw-r--r--src/PanelTray.cpp13
-rw-r--r--src/PanelTray.h2
-rw-r--r--src/PanelView.cpp2
-rw-r--r--src/PlacesController.cpp11
-rw-r--r--src/PlacesResultsController.cpp2
-rw-r--r--src/PlacesSearchBar.cpp2
-rw-r--r--src/PlacesSearchBarSpinner.cpp8
-rw-r--r--src/PlacesTile.cpp2
-rw-r--r--src/PlacesVScrollBar.cpp2
-rw-r--r--src/PlacesView.cpp37
-rw-r--r--src/PlacesView.h6
-rw-r--r--src/QuicklistMenuItemCheckmark.cpp8
-rw-r--r--src/QuicklistMenuItemLabel.cpp6
-rw-r--r--src/QuicklistMenuItemRadio.cpp8
-rw-r--r--src/QuicklistView.cpp45
-rw-r--r--src/QuicklistView.h4
-rw-r--r--src/WindowButtons.cpp2
33 files changed, 389 insertions, 144 deletions
diff --git a/src/BamfLauncherIcon.cpp b/src/BamfLauncherIcon.cpp
index 4b1c784fd..e9c65359e 100644
--- a/src/BamfLauncherIcon.cpp
+++ b/src/BamfLauncherIcon.cpp
@@ -104,6 +104,8 @@ BamfLauncherIcon::ActivateLauncherIcon ()
BamfLauncherIcon::BamfLauncherIcon (Launcher* IconManager, BamfApplication *app, CompScreen *screen)
: SimpleLauncherIcon(IconManager)
{
+ _cached_desktop_file = NULL;
+ _cached_name = NULL;
m_App = app;
m_Screen = screen;
_remote_uri = 0;
@@ -113,7 +115,7 @@ BamfLauncherIcon::BamfLauncherIcon (Launcher* IconManager, BamfApplication *app,
_menu_desktop_shortcuts = NULL;
char *icon_name = bamf_view_get_icon (BAMF_VIEW (m_App));
- SetTooltipText (bamf_view_get_name (BAMF_VIEW (app)));
+ SetTooltipText (BamfName ());
SetIconName (icon_name);
SetIconType (TYPE_APPLICATION);
@@ -172,6 +174,9 @@ BamfLauncherIcon::~BamfLauncherIcon()
g_signal_handlers_disconnect_by_func (m_App, (void *) &BamfLauncherIcon::OnClosed, this);
g_object_unref (m_App);
+
+ g_free (_cached_desktop_file);
+ g_free (_cached_name);
}
void
@@ -199,7 +204,35 @@ BamfLauncherIcon::IsSticky ()
const char*
BamfLauncherIcon::DesktopFile ()
{
- return bamf_application_get_desktop_file (m_App);
+ char *filename = NULL;
+ filename = (char*) bamf_application_get_desktop_file (m_App);
+
+ if (filename != NULL)
+ {
+ if (_cached_desktop_file != NULL)
+ g_free (_cached_desktop_file);
+
+ _cached_desktop_file = g_strdup (filename);
+ }
+
+ return _cached_desktop_file;
+}
+
+const char*
+BamfLauncherIcon::BamfName ()
+{
+ char *name = NULL;
+ name = (char *)bamf_view_get_name (BAMF_VIEW (m_App));
+
+ if (name != NULL)
+ {
+ if (_cached_name != NULL)
+ g_free (_cached_name);
+
+ _cached_name = g_strdup (name);
+ }
+
+ return _cached_name;
}
void
@@ -692,12 +725,7 @@ BamfLauncherIcon::OnTogglePin (DbusmenuMenuitem *item, int time, BamfLauncherIco
if (sticky)
{
- bamf_view_set_sticky (view, false);
- if (bamf_view_is_closed (view))
- self->Remove ();
-
- if (desktop_file && strlen (desktop_file) > 0)
- FavoriteStore::GetDefault ()->RemoveFavorite (desktop_file);
+ self->UnStick ();
}
else
{
@@ -825,7 +853,7 @@ BamfLauncherIcon::GetMenus ()
}
gchar *app_name;
- app_name = g_markup_escape_text (bamf_view_get_name (BAMF_VIEW (m_App)), -1);
+ app_name = g_markup_escape_text (BamfName (), -1);
item = dbusmenu_menuitem_new ();
dbusmenu_menuitem_property_set (item,
diff --git a/src/BamfLauncherIcon.h b/src/BamfLauncherIcon.h
index 89a55a47a..f5120f9bb 100644
--- a/src/BamfLauncherIcon.h
+++ b/src/BamfLauncherIcon.h
@@ -66,6 +66,8 @@ protected:
std::list<char *> ValidateUrisForLaunch (std::list<char *> uris);
+ const char* BamfName ();
+
private:
BamfApplication *m_App;
CompScreen *m_Screen;
@@ -80,6 +82,9 @@ private:
sigc::connection _on_window_minimized_connection;
sigc::connection _hidden_changed_connection;
+ gchar *_cached_desktop_file;
+ gchar *_cached_name;
+
void EnsureWindowState ();
void UpdateMenus ();
diff --git a/src/DeviceLauncherSection.cpp b/src/DeviceLauncherSection.cpp
index 9317fc471..425cc90ea 100644
--- a/src/DeviceLauncherSection.cpp
+++ b/src/DeviceLauncherSection.cpp
@@ -41,7 +41,7 @@ DeviceLauncherSection::DeviceLauncherSection (Launcher *launcher)
G_CALLBACK (&DeviceLauncherSection::OnMountAdded),
this);
- g_idle_add ((GSourceFunc)&DeviceLauncherSection::PopulateEntries, this);
+ _on_device_populate_entry_id = g_idle_add ((GSourceFunc)&DeviceLauncherSection::PopulateEntries, this);
}
DeviceLauncherSection::~DeviceLauncherSection ()
@@ -58,6 +58,9 @@ DeviceLauncherSection::~DeviceLauncherSection ()
g_signal_handler_disconnect ((gpointer) _monitor,
_on_mount_added_handler_id);
+ if (_on_device_populate_entry_id)
+ g_source_remove (_on_device_populate_entry_id);
+
g_object_unref (_monitor);
g_hash_table_unref (_ht);
}
@@ -81,6 +84,8 @@ DeviceLauncherSection::PopulateEntries (DeviceLauncherSection *self)
}
g_list_free (volumes);
+
+ self->_on_device_populate_entry_id = 0;
return false;
}
diff --git a/src/DeviceLauncherSection.h b/src/DeviceLauncherSection.h
index 288541e85..9ca06b109 100644
--- a/src/DeviceLauncherSection.h
+++ b/src/DeviceLauncherSection.h
@@ -56,6 +56,7 @@ private:
gulong _on_volume_added_handler_id;
gulong _on_volume_removed_handler_id;
gulong _on_mount_added_handler_id;
+ gulong _on_device_populate_entry_id;
};
#endif // _DEVICE_LAUNCHER_SECTION_H_
diff --git a/src/Launcher.cpp b/src/Launcher.cpp
index 2c6aa98fb..abaaaf48d 100644
--- a/src/Launcher.cpp
+++ b/src/Launcher.cpp
@@ -357,11 +357,19 @@ Launcher::Launcher (nux::BaseWindow* parent,
_launcher_drag_delta = 0;
_dnd_delta_y = 0;
_dnd_delta_x = 0;
- _autoscroll_handle = 0;
- _redraw_handle = 0;
- _start_dragicon_handle = 0;
- _focus_keynav_handle = 0;
- _dnd_check_handle = 0;
+
+ _autoscroll_handle = 0;
+ _super_show_launcher_handle = 0;
+ _super_hide_launcher_handle = 0;
+ _super_show_shortcuts_handle = 0;
+ _start_dragicon_handle = 0;
+ _focus_keynav_handle = 0;
+ _dnd_check_handle = 0;
+ _ignore_repeat_shortcut_handle = 0;
+
+ _latest_shortcut = 0;
+ _super_pressed = false;
+ _shortcuts_shown = false;
_floating = false;
_hovered = false;
_hidden = false;
@@ -431,10 +439,23 @@ Launcher::~Launcher()
g_bus_unown_name (_dbus_owner);
if (_dnd_check_handle)
- {
g_source_remove (_dnd_check_handle);
- _dnd_check_handle = 0;
- }
+ if (_autoscroll_handle)
+ g_source_remove (_autoscroll_handle);
+ if (_focus_keynav_handle)
+ g_source_remove (_focus_keynav_handle);
+ if (_super_show_launcher_handle)
+ g_source_remove (_super_show_launcher_handle);
+ if (_super_show_shortcuts_handle)
+ g_source_remove (_super_show_shortcuts_handle);
+ if (_start_dragicon_handle)
+ g_source_remove (_start_dragicon_handle);
+ if (_ignore_repeat_shortcut_handle)
+ g_source_remove (_ignore_repeat_shortcut_handle);
+ if (_super_show_launcher_handle)
+ g_source_remove (_super_show_launcher_handle);
+ if (_super_hide_launcher_handle)
+ g_source_remove (_super_hide_launcher_handle);
// disconnect the huge number of signal-slot callbacks
if (_set_hidden_connection.connected ())
@@ -502,6 +523,7 @@ Launcher::~Launcher()
if (_on_drag_finish_connection.connected ())
_on_drag_finish_connection.disconnect ();
+
}
/* Introspection */
@@ -526,6 +548,7 @@ Launcher::cairoToTexture2D (const char label, int width, int height)
gchar* fontName = NULL;
double label_pos = double(_icon_size / 3.0f);
+ double text_size = double(_icon_size / 4.0f);
double label_x = label_pos;
double label_y = label_pos;
double label_w = label_pos;
@@ -543,7 +566,7 @@ Launcher::cairoToTexture2D (const char label, int width, int height)
layout = pango_cairo_create_layout (cr);
g_object_get (settings, "gtk-font-name", &fontName, NULL);
desc = pango_font_description_from_string (fontName);
- pango_font_description_set_absolute_size (desc, label_pos * PANGO_SCALE);
+ pango_font_description_set_absolute_size (desc, text_size * PANGO_SCALE);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, &label, 1);
pangoCtx = pango_layout_get_context (layout); // is not ref'ed
@@ -652,6 +675,7 @@ Launcher::MoveFocusToKeyNavModeTimeout (gpointer data)
NULL);
self->selection_change.emit ();
+ self->_focus_keynav_handle = 0;
return false;
}
@@ -1479,44 +1503,89 @@ void Launcher::RenderArgs (std::list<Launcher::RenderArg> &launcher_args,
gboolean Launcher::TapOnSuper ()
{
struct timespec current;
- bool tap_on_super;
- bool shortcuts_shown = false;
clock_gettime (CLOCK_MONOTONIC, &current);
- tap_on_super = (TimeDelta (&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);
-
- if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN))
- shortcuts_shown = !tap_on_super;
-
- _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, shortcuts_shown);
-
- return tap_on_super;
-
+ return (TimeDelta (&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);
}
/* Launcher Show/Hide logic */
void Launcher::StartKeyShowLauncher ()
{
- _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true);
+ _super_pressed = true;
_hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
- QueueDraw ();
- SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION);
- if (_redraw_handle > 0)
- g_source_remove (_redraw_handle);
- _redraw_handle = g_timeout_add (SUPER_TAP_DURATION, &Launcher::DrawLauncherTimeout, this);
+
+ SetTimeStruct (&_times[TIME_TAP_SUPER]);
+ SetTimeStruct (&_times[TIME_SUPER_PRESSED]);
+
+ if (_super_show_launcher_handle > 0)
+ g_source_remove (_super_show_launcher_handle);
+ _super_show_launcher_handle = g_timeout_add (SUPER_TAP_DURATION, &Launcher::SuperShowLauncherTimeout, this);
+
+ if (_super_show_shortcuts_handle > 0)
+ g_source_remove (_super_show_shortcuts_handle);
+ _super_show_shortcuts_handle = g_timeout_add (SHORTCUTS_SHOWN_DELAY, &Launcher::SuperShowShortcutsTimeout, this);
}
void Launcher::EndKeyShowLauncher ()
{
-
- _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false);
- _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, false);
+ int remaining_time_before_hide;
+ struct timespec current;
+ clock_gettime (CLOCK_MONOTONIC, &current);
+
+ _hover_machine->SetQuirk (LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, false);
+ _super_pressed = false;
+ _shortcuts_shown = false;
QueueDraw ();
+
+ // remove further show launcher (which can happen when we close the dash with super)
+ if (_super_show_launcher_handle > 0)
+ g_source_remove (_super_show_launcher_handle);
+ if (_super_show_shortcuts_handle > 0)
+ g_source_remove (_super_show_shortcuts_handle);
+
+ // it's a tap on super and we didn't use any shortcuts
+ if (TapOnSuper () && !_latest_shortcut)
+ ubus_server_send_message (ubus_server_get_default (), UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
+
+ remaining_time_before_hide = BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION - CLAMP ((int) (TimeDelta (&current, &_times[TIME_SUPER_PRESSED])), 0, BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION);
+
+ if (_super_hide_launcher_handle > 0)
+ g_source_remove (_super_hide_launcher_handle);
+ _super_hide_launcher_handle = g_timeout_add (remaining_time_before_hide, &Launcher::SuperHideLauncherTimeout, this);
+}
+
+gboolean Launcher::SuperHideLauncherTimeout (gpointer data)
+{
+ Launcher *self = (Launcher*) data;
+
+ self->_hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_SHOW, false);
+
+ self->_super_hide_launcher_handle = 0;
+ return false;
+}
+
+gboolean Launcher::SuperShowLauncherTimeout (gpointer data)
+{
+ Launcher *self = (Launcher*) data;
+
+ self->_hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_SHOW, true);
+
+ self->_super_show_launcher_handle = 0;
+ return false;
+}
- // it's a tap on super
- if (TapOnSuper ())
- ubus_server_send_message (ubus_server_get_default (), UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
+gboolean Launcher::SuperShowShortcutsTimeout (gpointer data)
+{
+ Launcher *self = (Launcher*) data;
+
+ self->_shortcuts_shown = true;
+ self->_hover_machine->SetQuirk (LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, true);
+
+ self->QueueDraw ();
+
+ self->_super_show_shortcuts_handle = 0;
+ return false;
}
void Launcher::OnPlaceViewShown (GVariant *data, void *val)
@@ -1647,14 +1716,6 @@ Launcher::GetMouseY ()
return _mouse_position.y;
}
-gboolean Launcher::DrawLauncherTimeout (gpointer data)
-{
- Launcher *self = (Launcher*) data;
-
- self->QueueDraw ();
- return false;
-}
-
bool
Launcher::CheckIntersectWindow (CompWindow *window)
{
@@ -1975,6 +2036,7 @@ gboolean Launcher::OnScrollTimeout (gpointer data)
}
self->EnsureAnimation ();
+ self->_autoscroll_handle = 0;
return TRUE;
}
@@ -2133,10 +2195,10 @@ void Launcher::RenderIndicators (nux::GraphicsEngine& GfxContext,
{
nux::TexCoordXForm texxform;
- nux::Color color = nux::Color::LightGrey;
+ nux::Color color = nux::Colors::LightGrey;
if (arg.running_colored)
- color = nux::Color::SkyBlue;
+ color = nux::Colors::SkyBlue;
color.SetRGBA (color.R () * alpha, color.G () * alpha,
color.B () * alpha, alpha);
@@ -2187,7 +2249,7 @@ void Launcher::RenderIndicators (nux::GraphicsEngine& GfxContext,
{
nux::TexCoordXForm texxform;
- nux::Color color = nux::Color::LightGrey;
+ nux::Color color = nux::Colors::LightGrey;
color.SetRGBA (color.R () * alpha, color.G () * alpha,
color.B () * alpha, alpha);
GfxContext.QRP_1Tex ((geo.x + geo.width) - _arrow_rtl->GetWidth (),
@@ -2431,7 +2493,7 @@ void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg const &
RenderIcon (GfxContext,
arg,
arg.icon->TextureForSize (_icon_image_size)->GetDeviceTexture (),
- nux::Color::White,
+ nux::Colors::White,
arg.alpha,
arg.icon->_xform_coords["Image"]);
@@ -2441,7 +2503,7 @@ void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg const &
RenderIcon(GfxContext,
arg,
_icon_shine_texture->GetDeviceTexture (),
- nux::Color::White,
+ nux::Colors::White,
arg.backlight_intensity * arg.alpha,
arg.icon->_xform_coords["Tile"]);
}
@@ -2490,7 +2552,7 @@ void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg const &
RenderIcon(GfxContext,
arg,
_offscreen_progress_texture,
- nux::Color::White,
+ nux::Colors::White,
arg.alpha,
arg.icon->_xform_coords["Tile"]);
}
@@ -2500,7 +2562,7 @@ void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg const &
RenderIcon(GfxContext,
arg,
arg.icon->Emblem ()->GetDeviceTexture (),
- nux::Color::White,
+ nux::Colors::White,
arg.alpha,
arg.icon->_xform_coords["Emblem"]);
}
@@ -2514,7 +2576,7 @@ void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg const &
geo);
/* draw superkey-shortcut label */
- if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN) && !TapOnSuper ())
+ if (_shortcuts_shown)
{
guint64 shortcut = arg.icon->GetShortcut ();
@@ -2680,8 +2742,16 @@ gboolean Launcher::StartIconDragTimeout (gpointer data)
Launcher *self = (Launcher*) data;
// if we are still waiting…
- if (self->GetActionState () == ACTION_NONE)
+ if (self->GetActionState () == ACTION_NONE) {
+ if (self->_icon_under_mouse)
+ {
+ self->_icon_under_mouse->MouseLeave.emit ();
+ self->_icon_under_mouse->_mouse_inside = false;
+ self->_icon_under_mouse = 0;
+ }
self->StartIconDragRequest (self->GetMouseX (), self->GetMouseY ());
+ }
+ self->_start_dragicon_handle = 0;
return false;
}
@@ -2696,6 +2766,7 @@ void Launcher::StartIconDragRequest (int x, int y)
StartIconDrag (drag_icon);
SetActionState (ACTION_DRAG_ICON);
UpdateDragWindowPosition (x, y);
+ EnsureAnimation ();
}
}
@@ -2917,26 +2988,53 @@ void Launcher::RecvMouseWheel(int x, int y, int wheel_delta, unsigned long butto
EnsureAnimation ();
}
+
+gboolean
+Launcher::ResetRepeatShorcutTimeout (gpointer data)
+{
+ Launcher *self = (Launcher*) data;
+
+ self->_latest_shortcut = 0;
+
+ self->_ignore_repeat_shortcut_handle = 0;
+ return false;
+}
+
gboolean
Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
unsigned long key_code,
unsigned long key_state)
{
- if (!_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN))
+ if (!_super_pressed)
return false;
LauncherModel::iterator it;
- int i;
// Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
- for (it = _model->begin (), i = 0; it != _model->end (); it++, i++)
+ for (it = _model->begin (); it != _model->end (); it++)
{
if (XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code)
{
+ /*
+ * start a timeout while repressing the same shortcut will be ignored.
+ * This is because the keypress repeat is handled by Xorg and we have no
+ * way to know if a press is an actual press or just an automated repetition
+ * because the button is hold down. (key release events are sent in both cases)
+ */
+ if (_ignore_repeat_shortcut_handle > 0)
+ g_source_remove (_ignore_repeat_shortcut_handle);
+ _ignore_repeat_shortcut_handle = g_timeout_add (IGNORE_REPEAT_SHORTCUT_DURATION, &Launcher::ResetRepeatShorcutTimeout, this);
+
+ if (_latest_shortcut == (*it)->GetShortcut ())
+ return true;
+
if (g_ascii_isdigit ((gchar) (*it)->GetShortcut ()) && (key_state & ShiftMask))
(*it)->OpenInstance ();
else
(*it)->Activate ();
+
+ _latest_shortcut = (*it)->GetShortcut ();
+
// disable the "tap on super" check
_times[TIME_TAP_SUPER].tv_sec = 0;
_times[TIME_TAP_SUPER].tv_nsec = 0;
@@ -3551,10 +3649,10 @@ Launcher::RenderProgressToTexture (nux::GraphicsEngine& GfxContext, nux::Intrusi
GfxContext.PushClippingRectangle(nux::Geometry (left_edge, 0, half_size, height));
GfxContext.QRP_1Tex (left_edge, progress_y, progress_width, progress_height,
- _progress_bar_trough->GetDeviceTexture (), texxform, nux::Color::White);
+ _progress_bar_trough->GetDeviceTexture (), texxform, nux::Colors::White);
GfxContext.QRP_1Tex (left_edge + fill_offset, fill_y, fill_width, fill_height,
- _progress_bar_fill->GetDeviceTexture (), texxform, nux::Color::White);
+ _progress_bar_fill->GetDeviceTexture (), texxform, nux::Colors::White);
GfxContext.PopClippingRectangle ();
@@ -3563,10 +3661,10 @@ Launcher::RenderProgressToTexture (nux::GraphicsEngine& GfxContext, nux::Intrusi
GfxContext.PushClippingRectangle(nux::Geometry (left_edge + half_size, 0, half_size, height));
GfxContext.QRP_1Tex (right_edge - progress_width, progress_y, progress_width, progress_height,
- _progress_bar_trough->GetDeviceTexture (), texxform, nux::Color::White);
+ _progress_bar_trough->GetDeviceTexture (), texxform, nux::Colors::White);
GfxContext.QRP_1Tex (right_edge - progress_width + fill_offset, fill_y, fill_width, fill_height,
- _progress_bar_fill->GetDeviceTexture (), texxform, nux::Color::White);
+ _progress_bar_fill->GetDeviceTexture (), texxform, nux::Colors::White);
GfxContext.PopClippingRectangle ();
diff --git a/src/Launcher.h b/src/Launcher.h
index 018e31bab..c17a60c4b 100644
--- a/src/Launcher.h
+++ b/src/Launcher.h
@@ -42,7 +42,11 @@
#define ANIM_DURATION_LONG 350
#define SUPER_TAP_DURATION 250
+#define SHORTCUTS_SHOWN_DELAY 750
#define START_DRAGICON_DURATION 500
+#define BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION 1000
+
+#define IGNORE_REPEAT_SHORTCUT_DURATION 250
#define MAX_SUPERKEY_LABELS 10
@@ -197,6 +201,7 @@ private:
TIME_DRAG_EDGE_TOUCH,
TIME_DRAG_OUT,
TIME_TAP_SUPER,
+ TIME_SUPER_PRESSED,
TIME_LAST
} LauncherActionTimes;
@@ -237,10 +242,13 @@ private:
void OnPluginStateChanged ();
static gboolean AnimationTimeout (gpointer data);
- static gboolean DrawLauncherTimeout (gpointer data);
+ static gboolean SuperShowLauncherTimeout (gpointer data);
+ static gboolean SuperHideLauncherTimeout (gpointer data);
+ static gboolean SuperShowShortcutsTimeout (gpointer data);
static gboolean StrutHack (gpointer data);
static gboolean MoveFocusToKeyNavModeTimeout (gpointer data);
static gboolean StartIconDragTimeout (gpointer data);
+ static gboolean ResetRepeatShorcutTimeout (gpointer data);
void SetMousePosition (int x, int y);
@@ -406,6 +414,10 @@ private:
bool _render_drag_window;
bool _check_window_over_launcher;
+ bool _shortcuts_shown;
+ bool _super_pressed;
+ guint64 _latest_shortcut;
+
BacklightMode _backlight_mode;
float _folded_angle;
@@ -461,9 +473,12 @@ private:
guint _autoscroll_handle;
guint _focus_keynav_handle;
- guint _redraw_handle;
+ guint _super_show_launcher_handle;
+ guint _super_hide_launcher_handle;
+ guint _super_show_shortcuts_handle;
guint _start_dragicon_handle;
guint _dnd_check_handle;
+ guint _ignore_repeat_shortcut_handle;
nux::Point2 _mouse_position;
nux::Point2 _bfb_mouse_position;
diff --git a/src/LauncherController.cpp b/src/LauncherController.cpp
index 993a95b20..38ae7141a 100644
--- a/src/LauncherController.cpp
+++ b/src/LauncherController.cpp
@@ -99,7 +99,7 @@ LauncherController::OnLauncherAddRequest (char *path, LauncherIcon *before)
launchers = _model->GetSublist<BamfLauncherIcon> ();
for (it = launchers.begin (); it != launchers.end (); it++)
{
- if (g_str_equal (path, (*it)->DesktopFile ()))
+ if (!g_strcmp0 (path, (*it)->DesktopFile ()))
return;
}
diff --git a/src/LauncherDragWindow.cpp b/src/LauncherDragWindow.cpp
index c7837753a..aff931f22 100644
--- a/src/LauncherDragWindow.cpp
+++ b/src/LauncherDragWindow.cpp
@@ -115,7 +115,7 @@ LauncherDragWindow::DrawContent (nux::GraphicsEngine& GfxContext, bool force_dra
_icon->GetHeight(),
_icon,
texxform,
- nux::Color::White);
+ nux::Colors::White);
GfxContext.PopClippingRectangle ();
}
diff --git a/src/LauncherHideMachine.cpp b/src/LauncherHideMachine.cpp
index 42203c80d..eb2f00637 100644
--- a/src/LauncherHideMachine.cpp
+++ b/src/LauncherHideMachine.cpp
@@ -25,6 +25,9 @@ LauncherHideMachine::LauncherHideMachine ()
_quirks = DEFAULT;
_should_hide = false;
+ _latest_emit_should_hide = false;
+ _hide_changed_emit_handle = 0;
+
_hide_delay_handle = 0;
_hide_delay_timeout_length = 750;
}
@@ -36,6 +39,11 @@ LauncherHideMachine::~LauncherHideMachine ()
g_source_remove (_hide_delay_handle);
_hide_delay_handle = 0;
}
+ if (_hide_changed_emit_handle)
+ {
+ g_source_remove (_hide_changed_emit_handle);
+ _hide_changed_emit_handle = 0;
+ }
}
void
@@ -54,7 +62,10 @@ LauncherHideMachine::SetShouldHide (bool value, bool skip_delay)
else
{
_should_hide = value;
- should_hide_changed.emit (value);
+
+ if (_hide_changed_emit_handle)
+ g_source_remove (_hide_changed_emit_handle);
+ _hide_changed_emit_handle = g_timeout_add (0, &EmitShouldHideChanged, this);
}
}
@@ -66,7 +77,7 @@ LauncherHideMachine::SetShouldHide (bool value, bool skip_delay)
QUICKLIST_OPEN = 1 << 4, 16 #VISIBLE_REQUIRED
EXTERNAL_DND_ACTIVE = 1 << 5, 32 #VISIBLE_REQUIRED
INTERNAL_DND_ACTIVE = 1 << 6, 64 #VISIBLE_REQUIRED
- TRIGGER_BUTTON_DOWN = 1 << 7, 128 #VISIBLE_REQUIRED
+ TRIGGER_BUTTON_SHOW = 1 << 7, 128 #VISIBLE_REQUIRED
ANY_WINDOW_UNDER = 1 << 8, 256
ACTIVE_WINDOW_UNDER = 1 << 9, 512
DND_PUSHED_OFF = 1 << 10, 1024
@@ -81,7 +92,7 @@ LauncherHideMachine::SetShouldHide (bool value, bool skip_delay)
*/
#define VISIBLE_REQUIRED (QUICKLIST_OPEN | EXTERNAL_DND_ACTIVE | \
-INTERNAL_DND_ACTIVE | TRIGGER_BUTTON_DOWN | VERTICAL_SLIDE_ACTIVE |\
+INTERNAL_DND_ACTIVE | TRIGGER_BUTTON_SHOW | VERTICAL_SLIDE_ACTIVE |\
KEY_NAV_ACTIVE | PLACES_VISIBLE | SCALE_ACTIVE | EXPO_ACTIVE |\
MT_DRAG_OUT)
@@ -160,7 +171,7 @@ LauncherHideMachine::GetMode ()
}
#define SKIP_DELAY_QUIRK (EXTERNAL_DND_ACTIVE | DND_PUSHED_OFF | ACTIVE_WINDOW_UNDER | \
-ANY_WINDOW_UNDER | EXPO_ACTIVE | SCALE_ACTIVE | MT_DRAG_OUT)
+ANY_WINDOW_UNDER | EXPO_ACTIVE | SCALE_ACTIVE | MT_DRAG_OUT | TRIGGER_BUTTON_SHOW)
void
LauncherHideMachine::SetQuirk (LauncherHideMachine::HideQuirk quirk, bool active)
@@ -207,6 +218,21 @@ LauncherHideMachine::OnHideDelayTimeout (gpointer data)
return false;
}
+gboolean
+LauncherHideMachine::EmitShouldHideChanged (gpointer data)
+{
+ LauncherHideMachine *self = static_cast<LauncherHideMachine *> (data);
+
+ self->_hide_changed_emit_handle = 0;
+ if (self->_should_hide == self->_latest_emit_should_hide)
+ return false;
+
+ self->_latest_emit_should_hide = self->_should_hide;
+ self->should_hide_changed.emit (self->_should_hide);
+
+ return false;
+}
+
char*
LauncherHideMachine::DebugHideQuirks ()
{
diff --git a/src/LauncherHideMachine.h b/src/LauncherHideMachine.h
index b21b8143a..f08e0fd38 100644
--- a/src/LauncherHideMachine.h
+++ b/src/LauncherHideMachine.h
@@ -44,7 +44,7 @@ class LauncherHideMachine : public sigc::trackable
QUICKLIST_OPEN = 1 << 4,
EXTERNAL_DND_ACTIVE = 1 << 5,
INTERNAL_DND_ACTIVE = 1 << 6,
- TRIGGER_BUTTON_DOWN = 1 << 7,
+ TRIGGER_BUTTON_SHOW = 1 << 7,
ANY_WINDOW_UNDER = 1 << 8,
ACTIVE_WINDOW_UNDER = 1 << 9,
DND_PUSHED_OFF = 1 << 10,
@@ -78,13 +78,16 @@ class LauncherHideMachine : public sigc::trackable
void SetShouldHide (bool value, bool skip_delay);
static gboolean OnHideDelayTimeout (gpointer data);
+ static gboolean EmitShouldHideChanged (gpointer data);
bool _should_hide;
+ bool _latest_emit_should_hide;
HideQuirk _quirks;
HideMode _mode;
unsigned int _hide_delay_timeout_length;
guint _hide_delay_handle;
+ guint _hide_changed_emit_handle;
};
#endif
diff --git a/src/LauncherHoverMachine.cpp b/src/LauncherHoverMachine.cpp
index b12240d70..65a52a60b 100644
--- a/src/LauncherHoverMachine.cpp
+++ b/src/LauncherHoverMachine.cpp
@@ -23,7 +23,7 @@ LauncherHoverMachine::LauncherHoverMachine ()
{
_quirks = DEFAULT;
_should_hover = false;
- _pending_should_hover = false; // avoid building a struct in the callback
+ _latest_emit_should_hover = false;
_hover_changed_emit_handle = 0;
}
@@ -42,7 +42,7 @@ LauncherHoverMachine::~LauncherHoverMachine ()
LAUNCHER_HIDDEN = 1 << 0, 1
MOUSE_OVER_LAUNCHER = 1 << 1, 2
MOUSE_OVER_BFB = 1 << 2, 4
- SHOTCUT_KEYS_VISIBLE = 1 << 3, 8
+ SHORTCUT_KEYS_VISIBLE = 1 << 3, 8
QUICKLIST_OPEN = 1 << 4, 16
KEY_NAV_ACTIVE = 1 << 5, 32
LAUNCHER_IN_ACTION = 1 << 6, 64
@@ -60,7 +60,7 @@ LauncherHoverMachine::EnsureHoverState ()
}
if (GetQuirk ((HoverQuirk) (MOUSE_OVER_LAUNCHER | MOUSE_OVER_BFB |
- SHOTCUT_KEYS_VISIBLE | KEY_NAV_ACTIVE |
+ SHORTCUT_KEYS_VISIBLE | KEY_NAV_ACTIVE |
QUICKLIST_OPEN | LAUNCHER_IN_ACTION)))
should_hover = true;
else
@@ -72,11 +72,11 @@ LauncherHoverMachine::EnsureHoverState ()
void
LauncherHoverMachine::SetShouldHover (bool value)
-{
+{
+ _should_hover = value;
+
if (_hover_changed_emit_handle)
g_source_remove (_hover_changed_emit_handle);
-
- _pending_should_hover = value;
_hover_changed_emit_handle = g_timeout_add (0, &EmitShouldHoverChanged, this);
}
@@ -84,14 +84,14 @@ gboolean
LauncherHoverMachine::EmitShouldHoverChanged (gpointer data)
{
LauncherHoverMachine *self = static_cast<LauncherHoverMachine *> (data);
-
- if (self->_should_hover == self->_pending_should_hover)
+
+ self->_hover_changed_emit_handle = 0;
+ if (self->_should_hover == self->_latest_emit_should_hover)
return false;
-
- self->_should_hover = self->_pending_should_hover;
- self->_hover_changed_emit_handle = 0;
+ self->_latest_emit_should_hover = self->_should_hover;
self->should_hover_changed.emit (self->_should_hover);
+
return false;
}
diff --git a/src/LauncherHoverMachine.h b/src/LauncherHoverMachine.h
index ca703cf57..fb4bacd32 100644
--- a/src/LauncherHoverMachine.h
+++ b/src/LauncherHoverMachine.h
@@ -33,7 +33,7 @@ class LauncherHoverMachine : public sigc::trackable
LAUNCHER_HIDDEN = 1 << 0,
MOUSE_OVER_LAUNCHER = 1 << 1,
MOUSE_OVER_BFB = 1 << 2,
- SHOTCUT_KEYS_VISIBLE = 1 << 3,
+ SHORTCUT_KEYS_VISIBLE = 1 << 3,
QUICKLIST_OPEN = 1 << 4,
KEY_NAV_ACTIVE = 1 << 5,
LAUNCHER_IN_ACTION = 1 << 6,
@@ -56,7 +56,7 @@ class LauncherHoverMachine : public sigc::trackable
static gboolean EmitShouldHoverChanged (gpointer data);
bool _should_hover;
- bool _pending_should_hover;
+ bool _latest_emit_should_hover;
HoverQuirk _quirks;
guint _hover_changed_emit_handle;
diff --git a/src/LauncherIcon.cpp b/src/LauncherIcon.cpp
index b31efd117..d086fbe5e 100644
--- a/src/LauncherIcon.cpp
+++ b/src/LauncherIcon.cpp
@@ -65,8 +65,8 @@ LauncherIcon::LauncherIcon(Launcher* launcher)
_related_windows = 0;
- _background_color = nux::Color::White;
- _glow_color = nux::Color::White;
+ _background_color = nux::Colors::White;
+ _glow_color = nux::Colors::White;
_mouse_inside = false;
_has_visible_window = false;
diff --git a/src/PanelHomeButton.cpp b/src/PanelHomeButton.cpp
index 9b1b0a13b..81483dead 100644
--- a/src/PanelHomeButton.cpp
+++ b/src/PanelHomeButton.cpp
@@ -150,7 +150,7 @@ PanelHomeButton::Refresh ()
rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; // Set the destination blend factor.
nux::TextureLayer* texture_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
texxform, // The Oject that defines the texture wraping and coordinate transformation.
- _urgent_count ? nux::Color (0xFF24C5F6) : nux::Color::White, // The color used to modulate the texture.
+ _urgent_count ? nux::Color (0xFF24C5F6) : nux::Colors::White, // The color used to modulate the texture.
true, // Write the alpha value of the texture to the destination buffer.
rop // Use the given raster operation to set the blending when the layer is being rendered.
);
diff --git a/src/PanelIndicatorObjectEntryView.cpp b/src/PanelIndicatorObjectEntryView.cpp
index c8f60f815..1bdc11943 100644
--- a/src/PanelIndicatorObjectEntryView.cpp
+++ b/src/PanelIndicatorObjectEntryView.cpp
@@ -295,7 +295,7 @@ PanelIndicatorObjectEntryView::Refresh ()
rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
nux::TextureLayer* texture_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
texxform,
- nux::Color::White,
+ nux::Colors::White,
true,
rop);
SetPaintLayer (texture_layer);
diff --git a/src/PanelMenuView.cpp b/src/PanelMenuView.cpp
index 4eed072f3..f3cef55e2 100644
--- a/src/PanelMenuView.cpp
+++ b/src/PanelMenuView.cpp
@@ -358,10 +358,10 @@ PanelMenuView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
GfxContext.QRP_2TexMod(geo.x, geo.y,
geo.width, geo.height,
_gradient_texture, texxform0,
- nux::Color::White,
+ nux::Colors::White,
_title_tex->GetDeviceTexture (),
texxform1,
- nux::Color::White);
+ nux::Colors::White);
GfxContext.GetRenderStates ().SetBlend (alpha, src, dest);
// The previous blend is too aggressive on the texture and therefore there
@@ -608,7 +608,7 @@ PanelMenuView::Refresh ()
rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
_title_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
texxform,
- nux::Color::White,
+ nux::Colors::White,
true,
rop);
@@ -948,7 +948,7 @@ PanelMenuView::OnMaximizedGrab (int x, int y)
if (window_xid != 0)
{
WindowManager::Default ()->Activate (window_xid);
- _is_inside = false;
+ _is_inside = true;
_is_grabbed = true;
Refresh ();
FullRedraw ();
diff --git a/src/PanelTray.cpp b/src/PanelTray.cpp
index a38a05e9f..1c2ad89bf 100644
--- a/src/PanelTray.cpp
+++ b/src/PanelTray.cpp
@@ -24,9 +24,7 @@
PanelTray::PanelTray ()
: _n_children (0),
_last_x (0),
- _last_y (0),
- _idle_add_sync_handler (0),
- _idle_remove_sync_handler (0)
+ _last_y (0)
{
_settings = g_settings_new (SETTINGS_NAME);
_whitelist = g_settings_get_strv (_settings, "systray-whitelist");
@@ -66,10 +64,7 @@ PanelTray::~PanelTray ()
{
if (_tray_expose_id)
g_signal_handler_disconnect (_window, _tray_expose_id);
- if (_idle_remove_sync_handler)
- g_source_remove (_idle_remove_sync_handler);
- if (_idle_add_sync_handler)
- g_source_remove (_idle_add_sync_handler);
+ g_idle_remove_by_data (this);
g_strfreev (_whitelist);
g_object_unref (_settings);
@@ -145,7 +140,7 @@ PanelTray::FilterTrayCallback (NaTray *tray, NaTrayChild *icon, PanelTray *self)
na_tray_child_set_composited (icon, TRUE);
self->_n_children++;
- self->_idle_add_sync_handler = g_idle_add ((GSourceFunc)IdleSync, self);
+ g_idle_add ((GSourceFunc)IdleSync, self);
}
g_debug ("TrayChild %s: %s %s %s",
@@ -164,7 +159,7 @@ PanelTray::FilterTrayCallback (NaTray *tray, NaTrayChild *icon, PanelTray *self)
void
PanelTray::OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self)
{
- self->_idle_remove_sync_handler = g_idle_add ((GSourceFunc)IdleSync, self);
+ g_idle_add ((GSourceFunc)IdleSync, self);
self->_n_children--;
}
diff --git a/src/PanelTray.h b/src/PanelTray.h
index 4a6384a7e..b227a5580 100644
--- a/src/PanelTray.h
+++ b/src/PanelTray.h
@@ -71,7 +71,5 @@ private:
int _last_y;
gulong _tray_expose_id;
- guint _idle_add_sync_handler;
- guint _idle_remove_sync_handler;
};
#endif
diff --git a/src/PanelView.cpp b/src/PanelView.cpp
index 41a75b501..f25ea39aa 100644
--- a/src/PanelView.cpp
+++ b/src/PanelView.cpp
@@ -195,7 +195,7 @@ PanelView::UpdateBackground ()
rop.Blend = true;
rop.SrcBlend = GL_ONE;
rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- nux::Color col = nux::Color::White;
+ nux::Color col = nux::Colors::White;
col.SetAlpha (_opacity);
_bg_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
diff --git a/src/PlacesController.cpp b/src/PlacesController.cpp
index 754a957c3..cb0cbc81c 100644
--- a/src/PlacesController.cpp
+++ b/src/PlacesController.cpp
@@ -123,6 +123,9 @@ void PlacesController::Show ()
{
if (_visible)
return;
+
+ if (PluginAdapter::Default ()->IsExpoActive () || PluginAdapter::Default ()->IsScaleActive ())
+ return;
if (PluginAdapter::Default ()->IsScreenGrabbed ())
{
@@ -159,8 +162,6 @@ void PlacesController::Hide ()
_visible = false;
_fullscren_request = false;
- _view->SetActiveEntry (NULL, 0, "");
-
StartShowHideTimeline ();
ubus_server_send_message (ubus_server_get_default (), UBUS_PLACE_VIEW_HIDDEN, NULL);
@@ -215,8 +216,12 @@ PlacesController::OnViewShowHideFrame (PlacesController *self)
// Make sure the state is right
self->_window->SetOpacity (self->_visible ? 1.0f : 0.0f);
if (!self->_visible)
+ {
self->_window->ShowWindow (false, false);
-
+ //reset the active entry
+ self->_view->SetActiveEntry (NULL, 0, "");
+ }
+
return FALSE;
}
return TRUE;
diff --git a/src/PlacesResultsController.cpp b/src/PlacesResultsController.cpp
index 0f97bf1f1..a27c414b9 100644
--- a/src/PlacesResultsController.cpp
+++ b/src/PlacesResultsController.cpp
@@ -36,6 +36,8 @@ PlacesResultsController::PlacesResultsController ()
PlacesResultsController::~PlacesResultsController ()
{
+ if (_make_things_look_nice_id)
+ g_source_remove (_make_things_look_nice_id);
_results_view->UnReference ();
}
diff --git a/src/PlacesSearchBar.cpp b/src/PlacesSearchBar.cpp
index 1cd9775d1..cedf35534 100644
--- a/src/PlacesSearchBar.cpp
+++ b/src/PlacesSearchBar.cpp
@@ -492,7 +492,7 @@ PlacesSearchBar::UpdateBackground ()
_bg_layer = new nux::TextureLayer (texture2D->GetDeviceTexture(),
texxform, // The Oject that defines the texture wraping and coordinate transformation.
- nux::Color::White, // The color used to modulate the texture.
+ nux::Colors::White, // The color used to modulate the texture.
true, // Write the alpha value of the texture to the destination buffer.
rop // Use the given raster operation to set the blending when the layer is being rendered.
);
diff --git a/src/PlacesSearchBarSpinner.cpp b/src/PlacesSearchBarSpinner.cpp
index 3ba3f2e40..6f9ec9ead 100644
--- a/src/PlacesSearchBarSpinner.cpp
+++ b/src/PlacesSearchBarSpinner.cpp
@@ -77,7 +77,7 @@ PlacesSearchBarSpinner::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
_search_ready->GetHeight (),
_search_ready->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
else if (_state == STATE_SEARCHING)
{
@@ -98,7 +98,7 @@ PlacesSearchBarSpinner::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
clear_geo.height,
_clear_spinner->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
GfxContext.PopModelViewMatrix ();
GfxContext.PopModelViewMatrix ();
@@ -110,7 +110,7 @@ PlacesSearchBarSpinner::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
_clear_alone->GetHeight (),
_clear_alone->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
else
{
@@ -120,7 +120,7 @@ PlacesSearchBarSpinner::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
_clear_full->GetHeight (),
_clear_full->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
GfxContext.PopClippingRectangle ();
diff --git a/src/PlacesTile.cpp b/src/PlacesTile.cpp
index 6fc942d70..ddeab7ec4 100644
--- a/src/PlacesTile.cpp
+++ b/src/PlacesTile.cpp
@@ -230,7 +230,7 @@ PlacesTile::UpdateBackground ()
_hilight_layer = new nux::TextureLayer (_hilight_background->GetDeviceTexture(),
texxform,
- nux::Color::White,
+ nux::Colors::White,
true,
rop);
}
diff --git a/src/PlacesVScrollBar.cpp b/src/PlacesVScrollBar.cpp
index 01354db0d..615f7111c 100644
--- a/src/PlacesVScrollBar.cpp
+++ b/src/PlacesVScrollBar.cpp
@@ -157,7 +157,7 @@ PlacesVScrollBar::PostLayoutManagement (long LayoutResult)
void
PlacesVScrollBar::Draw (nux::GraphicsEngine &gfxContext, bool force_draw)
{
- nux::Color color = nux::Color::White;
+ nux::Color color = nux::Colors::White;
nux::Geometry base = GetGeometry ();
nux::TexCoordXForm texxform;
diff --git a/src/PlacesView.cpp b/src/PlacesView.cpp
index e33c042d9..9e401f62c 100644
--- a/src/PlacesView.cpp
+++ b/src/PlacesView.cpp
@@ -41,6 +41,7 @@ NUX_IMPLEMENT_OBJECT_TYPE (PlacesView);
PlacesView::PlacesView (PlaceFactory *factory)
: nux::View (NUX_TRACKER_LOCATION),
+ _close_idle (0),
_factory (factory),
_entry (NULL),
_size_mode (SIZE_MODE_FULLSCREEN),
@@ -134,6 +135,11 @@ PlacesView::PlacesView (PlaceFactory *factory)
PlacesView::~PlacesView ()
{
+ if (_close_idle != 0)
+ {
+ g_source_remove (_close_idle);
+ _close_idle = 0;
+ }
delete _home_entry;
}
@@ -170,7 +176,6 @@ PlacesView::ProcessEvent(nux::IEvent &ievent, long TraverseInfo, long ProcessEve
geo.height = _actual_height;
if (!geo.IsPointInside (ievent.e_x, ievent.e_y))
{
- SetActiveEntry (NULL, 0, "");
return TraverseInfo |= nux::eMouseEventSolved;
}
}
@@ -227,7 +232,7 @@ PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
geo_absolute.x, geo_absolute.y, _bg_blur_geo.width, _bg_blur_geo.height);
nux::TexCoordXForm texxform__bg;
- _bg_blur_texture = GfxContext.QRP_GetBlurTexture (0, 0, _bg_blur_geo.width, _bg_blur_geo.height, _bg_texture, texxform__bg, nux::Color::White, 1.0f, 2);
+ _bg_blur_texture = GfxContext.QRP_GetBlurTexture (0, 0, _bg_blur_geo.width, _bg_blur_geo.height, _bg_texture, texxform__bg, nux::Colors::White, 1.0f, 2);
if (current_fbo.IsValid ())
{
@@ -261,7 +266,7 @@ PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
gPainter.PushDrawTextureLayer (GfxContext, _bg_blur_geo,
_bg_blur_texture,
texxform_blur__bg,
- nux::Color::White,
+ nux::Colors::White,
true,
rop);
@@ -295,7 +300,7 @@ PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
corner->GetHeight (),
corner->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
{ // Fullscreen toggle
@@ -305,7 +310,7 @@ PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
icon->GetHeight (),
icon->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
{ // Bottom repeated texture
@@ -321,7 +326,7 @@ PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
bottom->GetHeight (),
bottom->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
{ // Right repeated texture
@@ -337,7 +342,7 @@ PlacesView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw)
real_height + offset,
right->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
}
}
else
@@ -380,7 +385,7 @@ PlacesView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw)
gPainter.PushTextureLayer (GfxContext, _bg_blur_geo,
_bg_blur_texture,
texxform_blur__bg,
- nux::Color::White,
+ nux::Colors::White,
true,
rop);
bgs++;
@@ -419,6 +424,7 @@ PlacesView::AboutToShow ()
void
PlacesView::SetActiveEntry (PlaceEntry *entry, guint section_id, const char *search_string, bool signal)
{
+
if (signal)
entry_changed.emit (entry);
@@ -808,7 +814,22 @@ PlacesView::PlaceEntryActivateRequest (const char *entry_id,
void
PlacesView::CloseRequest (GVariant *data, PlacesView *self)
{
+ if (self->_close_idle != 0)
+ {
+ g_source_remove (self->_close_idle);
+ self->_close_idle = 0;
+ }
+
+ //add a timeout because the home view flashes on close
+ self->_close_idle = g_timeout_add_seconds (100, (GSourceFunc)OnCloseTimeout, self);
+}
+
+gboolean
+PlacesView::OnCloseTimeout (PlacesView *self)
+{
+ self->_close_idle = 0;
self->SetActiveEntry (NULL, 0, "");
+ return FALSE;
}
nux::TextEntry*
diff --git a/src/PlacesView.h b/src/PlacesView.h
index e26e6088a..17ff23e1b 100644
--- a/src/PlacesView.h
+++ b/src/PlacesView.h
@@ -101,8 +101,8 @@ protected:
void AddProperties (GVariantBuilder *builder);
private:
- static void CloseRequest (GVariant *data, PlacesView *self);
-
+ static void CloseRequest (GVariant *data, PlacesView *self);
+ static gboolean OnCloseTimeout (PlacesView *self);
void OnGroupAdded (PlaceEntry *entry, PlaceEntryGroup& group);
void OnResultAdded (PlaceEntry *entry, PlaceEntryGroup& group, PlaceEntryResult& result);
void OnResultRemoved (PlaceEntry *entry, PlaceEntryGroup& group, PlaceEntryResult& result);
@@ -130,6 +130,8 @@ private:
static gboolean OnSearchTimedOut (PlacesView *view);
private:
+ guint _close_idle;
+
PlaceFactory *_factory;
nux::HLayout *_layout;
nux::LayeredLayout *_layered_layout;
diff --git a/src/QuicklistMenuItemCheckmark.cpp b/src/QuicklistMenuItemCheckmark.cpp
index cc6c5d1e3..011a74eb3 100644
--- a/src/QuicklistMenuItemCheckmark.cpp
+++ b/src/QuicklistMenuItemCheckmark.cpp
@@ -178,7 +178,7 @@ QuicklistMenuItemCheckmark::Draw (nux::GraphicsEngine& gfxContext,
texture = _normalTexture[1]->GetDeviceTexture ();
}
- _color = nux::Color::White;
+ _color = nux::Colors::White;
}
else
{
@@ -191,7 +191,7 @@ QuicklistMenuItemCheckmark::Draw (nux::GraphicsEngine& gfxContext,
texture = _normalTexture[0]->GetDeviceTexture ();
}
- _color = nux::Color::Gray;
+ _color = nux::Colors::Gray;
}
gfxContext.QRP_1Tex (base.x,
@@ -236,7 +236,7 @@ QuicklistMenuItemCheckmark::UpdateTexture ()
cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f);
cairo_set_line_width (cr, 1.0f);
- DrawText (cr, width, height, nux::Color::White);
+ DrawText (cr, width, height, nux::Colors::White);
nux::NBitmapData* bitmap = _cairoGraphics->GetBitmap ();
@@ -278,7 +278,7 @@ QuicklistMenuItemCheckmark::UpdateTexture ()
cairo_restore (cr);
- DrawText (cr, width, height, nux::Color::White);
+ DrawText (cr, width, height, nux::Colors::White);
bitmap = _cairoGraphics->GetBitmap ();
diff --git a/src/QuicklistMenuItemLabel.cpp b/src/QuicklistMenuItemLabel.cpp
index 30aae47dd..9182d388b 100644
--- a/src/QuicklistMenuItemLabel.cpp
+++ b/src/QuicklistMenuItemLabel.cpp
@@ -157,12 +157,12 @@ QuicklistMenuItemLabel::Draw (nux::GraphicsEngine& gfxContext,
{
texture = _normalTexture[0]->GetDeviceTexture ();
}
- _color = nux::Color::White;
+ _color = nux::Colors::White;
}
else
{
texture = _normalTexture[0]->GetDeviceTexture ();
- _color = nux::Color::Gray;
+ _color = nux::Colors::Gray;
}
gfxContext.QRP_1Tex (base.x,
@@ -209,7 +209,7 @@ QuicklistMenuItemLabel::UpdateTexture ()
cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f);
cairo_set_line_width (cr, 1.0f);
- DrawText (cr, width, height, nux::Color::White);
+ DrawText (cr, width, height, nux::Colors::White);
nux::NBitmapData* bitmap = _cairoGraphics->GetBitmap ();
diff --git a/src/QuicklistMenuItemRadio.cpp b/src/QuicklistMenuItemRadio.cpp
index 66132a2c1..245ecfdbe 100644
--- a/src/QuicklistMenuItemRadio.cpp
+++ b/src/QuicklistMenuItemRadio.cpp
@@ -178,7 +178,7 @@ QuicklistMenuItemRadio::Draw (nux::GraphicsEngine& gfxContext,
texture = _normalTexture[1]->GetDeviceTexture ();
}
- _color = nux::Color::White;
+ _color = nux::Colors::White;
}
else
{
@@ -191,7 +191,7 @@ QuicklistMenuItemRadio::Draw (nux::GraphicsEngine& gfxContext,
texture = _normalTexture[0]->GetDeviceTexture ();
}
- _color = nux::Color::Gray;
+ _color = nux::Colors::Gray;
}
gfxContext.QRP_1Tex (base.x,
@@ -238,7 +238,7 @@ QuicklistMenuItemRadio::UpdateTexture ()
cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f);
cairo_set_line_width (cr, 1.0f);
- DrawText (cr, width, height, nux::Color::White);
+ DrawText (cr, width, height, nux::Colors::White);
nux::NBitmapData* bitmap = _cairoGraphics->GetBitmap ();
@@ -267,7 +267,7 @@ QuicklistMenuItemRadio::UpdateTexture ()
cairo_fill (cr);
cairo_set_source_rgba (cr, 1.0f, 1.0f, 1.0f, 1.0f);
- DrawText (cr, width, height, nux::Color::White);
+ DrawText (cr, width, height, nux::Colors::White);
bitmap = _cairoGraphics->GetBitmap ();
diff --git a/src/QuicklistView.cpp b/src/QuicklistView.cpp
index 2f9563a77..532c3f52b 100644
--- a/src/QuicklistView.cpp
+++ b/src/QuicklistView.cpp
@@ -123,6 +123,29 @@ QuicklistView::RecvEndFocus ()
{
}
+bool
+QuicklistView::IsMenuItemSeperator (int index)
+{
+ DbusmenuMenuitem* item = NULL;
+ const gchar* label = NULL;
+ bool result = false;
+
+ if (index < 0)
+ return false;
+
+ item = GetNthItems (index)->_menuItem;
+ if (!item)
+ return false;
+
+ label = dbusmenu_menuitem_property_get (item, DBUSMENU_MENUITEM_PROP_LABEL);
+ if (!label)
+ result = true;
+ else
+ result = false;
+
+ return result;
+}
+
void
QuicklistView::RecvKeyPressed (unsigned int key_sym,
unsigned long key_code,
@@ -133,10 +156,18 @@ QuicklistView::RecvKeyPressed (unsigned int key_sym,
// up (highlight previous menu-item)
case NUX_VK_UP:
case NUX_KP_UP:
+ // protect against edge-case of first item being a separator
+ if (_current_item_index == 1 && IsMenuItemSeperator (0))
+ break;
+
if (_current_item_index > 0)
{
GetNthItems (_current_item_index)->_prelight = false;
_current_item_index--;
+
+ while (IsMenuItemSeperator (_current_item_index))
+ _current_item_index--;
+
GetNthItems (_current_item_index)->_prelight = true;
QueueDraw ();
}
@@ -145,10 +176,18 @@ QuicklistView::RecvKeyPressed (unsigned int key_sym,
// down (highlight next menu-item)
case NUX_VK_DOWN:
case NUX_KP_DOWN:
+ // protect against edge-case of last item being a separator
+ if (_current_item_index == (GetNumItems () - 1) && IsMenuItemSeperator (GetNumItems ()))
+ break;
+
if (_current_item_index < GetNumItems () - 1)
{
GetNthItems (_current_item_index)->_prelight = false;
_current_item_index++;
+
+ while (IsMenuItemSeperator (_current_item_index))
+ _current_item_index++;
+
GetNthItems (_current_item_index)->_prelight = true;
QueueDraw ();
}
@@ -384,7 +423,7 @@ void QuicklistView::Draw (nux::GraphicsEngine& gfxContext, bool forceDraw)
nux::ObjectPtr <nux::IOpenGLBaseTexture> bkg_texture = gfxContext.CreateTextureFromBackBuffer (base.x, base.y, base.width, base.height);
nux::TexCoordXForm texxform_bkg;
- bkg_blur_texture = gfxContext.QRP_GetBlurTexture (0, 0, base.width, base.height, bkg_texture, texxform_bkg, nux::Color::White, 1.0f, 3);
+ bkg_blur_texture = gfxContext.QRP_GetBlurTexture (0, 0, base.width, base.height, bkg_texture, texxform_bkg, nux::Colors::White, 1.0f, 3);
if (current_fbo.IsValid ())
{
@@ -427,10 +466,10 @@ void QuicklistView::Draw (nux::GraphicsEngine& gfxContext, bool forceDraw)
base.height,
bkg_blur_texture,
texxform_blur_bkg,
- nux::Color::White,
+ nux::Colors::White,
_texture_mask->GetDeviceTexture(),
texxform_mask,
- nux::Color::White);
+ nux::Colors::White);
}
nux::GetGraphicsEngine ().GetRenderStates ().SetBlend (true);
diff --git a/src/QuicklistView.h b/src/QuicklistView.h
index 68e833c01..14c42e1fa 100644
--- a/src/QuicklistView.h
+++ b/src/QuicklistView.h
@@ -139,7 +139,9 @@ private:
//! Check the mouse up event sent by an item. Detect the item where the mous is and emit the appropriate signal.
void CheckAndEmitItemSignal (int x, int y);
-
+
+ bool IsMenuItemSeperator (int index);
+
//nux::CairoGraphics* _cairo_graphics;
int _anchorX;
int _anchorY;
diff --git a/src/WindowButtons.cpp b/src/WindowButtons.cpp
index fd4fc3e13..ad5760e59 100644
--- a/src/WindowButtons.cpp
+++ b/src/WindowButtons.cpp
@@ -83,7 +83,7 @@ public:
(float)geo.height,
tex->GetDeviceTexture (),
texxform,
- nux::Color::White);
+ nux::Colors::White);
GfxContext.GetRenderStates ().SetBlend (false);
GfxContext.PopClippingRectangle();
}