Commit bb1f980a authored by Allison Barlow's avatar Allison Barlow

fixes #894 display selection rectangle in focus-specific color

parent 353866c2
......@@ -301,7 +301,7 @@ public abstract class PageWindow : Gtk.Window {
private override bool key_press_event(Gdk.EventKey event) {
if (current_page != null && current_page.notify_app_key_pressed(event))
return true;
return true;
return (base.key_press_event != null) ? base.key_press_event(event) : false;
}
......
......@@ -1454,14 +1454,14 @@ public class CheckerboardLayout : Gtk.DrawingArea {
set_colors();
}
private void set_colors() {
private void set_colors(bool in_focus = true) {
if (selected_gc == null || unselected_gc == null || border_gc == null ||
selection_band_gc == null)
return;
// set up selected/unselected colors
Gdk.Color selected_color = fetch_color(
Config.get_instance().get_selected_color().to_string(), window);
Config.get_instance().get_selected_color(in_focus).to_string(), window);
Gdk.Color unselected_color = fetch_color(
Config.get_instance().get_unselected_color().to_string(), window);
Gdk.Color border_color = fetch_color(
......@@ -1592,9 +1592,23 @@ public class CheckerboardLayout : Gtk.DrawingArea {
modify_bg(Gtk.StateType.NORMAL, Config.get_instance().get_bg_color());
set_colors();
}
private void on_display_borders_changed(bool display_borders) {
this.display_borders = display_borders;
need_exposure("on_display_borders_changed");
}
private override bool focus_in_event(Gdk.EventFocus event) {
set_colors(true);
items_dirty("focus_in_event", view.get_selected());
return base.focus_in_event(event);
}
private override bool focus_out_event(Gdk.EventFocus event) {
set_colors(false);
items_dirty("focus_out_event", view.get_selected());
return base.focus_out_event(event);
}
}
......@@ -20,10 +20,13 @@ public class Config {
private const string LIGHT_UNSELECTED_COLOR = "#FFF";
private const string DARK_BORDER_COLOR = "#666";
private const string LIGHT_BORDER_COLOR = "#AAA";
private const string DARK_UNFOCUSED_SELECTED_COLOR = "#7a9299";
private const string LIGHT_UNFOCUSED_SELECTED_COLOR = "#ccf7ff";
private string bg_color = null;
private string selected_color = null;
private string unselected_color = null;
private string unfocused_selected_color = null;
private string border_color = null;
private static Config instance = null;
......@@ -529,11 +532,18 @@ public class Config {
return parse_color(bg_color);
}
public Gdk.Color get_selected_color() {
if (is_string_empty(selected_color))
get_colors();
public Gdk.Color get_selected_color(bool in_focus = true) {
if (in_focus) {
if (is_string_empty(selected_color))
get_colors();
return parse_color(selected_color);
} else {
if (is_string_empty(unfocused_selected_color))
get_colors();
return parse_color(selected_color);
return parse_color(unfocused_selected_color);
}
}
public Gdk.Color get_unselected_color() {
......@@ -557,10 +567,12 @@ public class Config {
if (bg_color.red > BLACK_THRESHOLD) {
selected_color = DARK_SELECTED_COLOR;
unselected_color = DARK_UNSELECTED_COLOR;
unfocused_selected_color = DARK_UNFOCUSED_SELECTED_COLOR;
border_color = DARK_BORDER_COLOR;
} else {
selected_color = LIGHT_SELECTED_COLOR;
unselected_color = LIGHT_UNSELECTED_COLOR;
unfocused_selected_color = LIGHT_UNFOCUSED_SELECTED_COLOR;
border_color = LIGHT_BORDER_COLOR;
}
}
......@@ -572,7 +584,7 @@ public class Config {
colors_changed();
}
public bool commit_bg_color() {
return set_string("/apps/shotwell/preferences/ui/background_color", bg_color);
}
......
......@@ -12,7 +12,7 @@ public class LibraryWindow : AppWindow {
public const int SORT_EVENTS_ORDER_ASCENDING = 0;
public const int SORT_EVENTS_ORDER_DESCENDING = 1;
private const string[] SUPPORTED_MOUNT_SCHEMES = {
"gphoto2:",
"disk:",
......@@ -1531,7 +1531,7 @@ public class LibraryWindow : AppWindow {
page.switched_to();
}
private bool is_page_selected(SidebarPage page, Gtk.TreePath path) {
SidebarMarker? marker = page.get_marker();
if (marker == null)
......@@ -1564,7 +1564,7 @@ public class LibraryWindow : AppWindow {
return false;
}
private bool is_event_selected(Gtk.TreePath path) {
foreach (EventPageStub event_stub in event_list) {
if (is_page_selected(event_stub, path)) {
......
......@@ -626,7 +626,7 @@ public abstract class Page : Gtk.ScrolledWindow, SidebarPage {
return on_app_key_released(event);
}
public bool notify_app_focus_in(Gdk.EventFocus event) {
update_modifiers();
......
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