Skip to content

Commit

Permalink
Add compile flag to style scrollbars for #239
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunn1 committed Apr 14, 2016
1 parent 1d5d33e commit e5cad88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions source/gx/terminix/constants.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ immutable bool USE_SCROLLED_WINDOW = false;
immutable bool USE_PIXBUF_DND = false;
immutable bool SHOW_DEBUG_OPTIONS = false;
immutable bool CLIPBOARD_BTN_IN_CONTEXT = true;
immutable bool STYLE_TERMINAL_SCROLLBAR = true;

//GTK Version required
immutable uint GTK_VERSION_MAJOR = 3;
Expand Down
17 changes: 9 additions & 8 deletions source/gx/terminix/terminal/terminal.d
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import glib.VariantType : GVariantType = VariantType;
import gtk.Box;
import gtk.Button;
import gtk.Clipboard;
import gtk.CssProvider;
import gtk.Dialog;
import gtk.DragAndDrop;
import gtk.EventBox;
Expand Down Expand Up @@ -1041,6 +1042,9 @@ private:
RGBA vteFG;
RGBA vteBG;
RGBA[16] vtePalette;
static if (STYLE_TERMINAL_SCROLLBAR) {
CssProvider provider;
}

void initColors() {
vteFG = new RGBA();
Expand Down Expand Up @@ -1088,21 +1092,18 @@ private:
trace("Parsing color failed " ~ colors[i]);
}
vte.setColors(vteFG, vteBG, vtePalette);
/**
//Fooling around with improving Ubuntu scrollbar look, nowhere near ready for primetime, do not uncomment for public builds

//Note for test purposes I just create a one-off provider and add it, obviously to support
//color changes this provider must be removed and a new one added which means the provider
//object has to be saved as a class field with the colors (vteFG, vteBG, etc)
static if (!USE_SCROLLED_WINDOW) {
import gtk.CssProvider;
static if (STYLE_TERMINAL_SCROLLBAR && !USE_SCROLLED_WINDOW) {
if (provider !is null) {
sb.getStyleContext().removeProvider(provider);
}
CssProvider provider = new CssProvider();
string css = format("* { background-color: %s; }", vteBG); //rgbaTo8bitHex(vteBG, true, true));
string css = format("* { background-color: %s; }", vteBG);
trace(css);
provider.loadFromData(css);
sb.getStyleContext().addProvider(provider, GTK_STYLE_PROVIDER_PRIORITY_FALLBACK);
}
**/
break;
case SETTINGS_PROFILE_SHOW_SCROLLBAR_KEY:
static if (!USE_SCROLLED_WINDOW) {
Expand Down

0 comments on commit e5cad88

Please sign in to comment.