~ter0/pantheon-terminal/fix-1244265-2

« back to all changes in this revision

Viewing changes to src/PantheonTerminalWindow.vala

  • Committer: Chris Johns
  • Date: 2014-06-07 10:47:26 UTC
  • Revision ID: cajohns.93@gmail.com-20140607104726-xm6mzdeq4o8714bg
Use a more opaque opacity for the background when fullscreened/maximized.

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
            notebook.tab_bar_behavior = settings.tab_bar_behavior;
181
181
            add (notebook);
182
182
 
 
183
            window_state_event.connect ((e) => {
 
184
                int state_mask = (Gdk.WindowState.MAXIMIZED | Gdk.WindowState.FULLSCREEN);
 
185
 
 
186
                if ((get_window ().get_state () & state_mask) != 0)
 
187
                    set_opacity_all (settings.opacity_fullscreen);
 
188
                else
 
189
                    set_opacity_all (settings.opacity);
 
190
 
 
191
                return false;
 
192
            });
 
193
 
183
194
            key_press_event.connect ((e) => {
184
195
                switch (e.keyval) {
185
196
                    case Gdk.Key.@0:
475
486
            t.grab_focus ();
476
487
        }
477
488
 
 
489
        private void set_opacity_all (int opacity_percent) {
 
490
            int opacity = opacity_percent * 65535;
 
491
 
 
492
            foreach (var t in terminals) {
 
493
                t = (TerminalWidget) t;
 
494
                t.set_opacity ((uint16) (opacity / 100));
 
495
                // force the background to redraw
 
496
                t.set_background_image (null);
 
497
            }
 
498
        }
 
499
 
478
500
        private Granite.Widgets.Tab create_tab (string label, GLib.Icon? icon, TerminalWidget term) {
479
501
            var g = new Gtk.Grid ();
480
502
            var sb = new Gtk.Scrollbar (Gtk.Orientation.VERTICAL, term.vadjustment);