Return a context manager that enters fullscreen mode while inside it
        and restores normal mode on leaving.
341195
def fullscreen(self):
        """"""
        self.stream.write(self.enter_fullscreen)
        try:
            yield
        finally:
            self.stream.write(self.exit_fullscreen)
347197
def _ClearScreen(self):
    """"""
    if self._have_ansi_support:
      # ANSI escape sequence to clear screen.
      self._output_writer.Write('\033[2J')
      # ANSI escape sequence to move cursor to top left.
      self._output_writer.Write('\033[H')

    elif win32console:
      # This version of Windows cmd.exe does not support ANSI escape codes, thus
      # instead we fill the console screen buffer with spaces. The downside of
      # this approach is an annoying flicker.
      top_left_coordinate = win32console.PyCOORDType(0, 0)
      screen_buffer = win32console.GetStdHandle(win32api.STD_OUTPUT_HANDLE)
      screen_buffer_information = screen_buffer.GetConsoleScreenBufferInfo()

      screen_buffer_attributes = screen_buffer_information['Attributes']
      screen_buffer_size = screen_buffer_information['Size']
      console_size = screen_buffer_size.X * screen_buffer_size.Y

      screen_buffer.FillConsoleOutputCharacter(
          ' ', console_size, top_left_coordinate)
      screen_buffer.FillConsoleOutputAttribute(
          screen_buffer_attributes, console_size, top_left_coordinate)
      screen_buffer.SetConsoleCursorPosition(top_left_coordinate)
1365085
public function adminInit ()
    {
        set_current_screen($this->menuSlug);
        $this->doUserFunc(function (AdminPageMode $mode) {
            return $mode->getInitFunc();
        });
    }
204327
function toggleFullscreen(element, callback) {
    if (callback && typeof callback === 'function') {
        if (!isFullscreen()) {
            var fn = function (e) {
                if (isFullscreen()) {
                    callback(true);
                }
                else {
                    callback(false);
                }
            };
            fullscreenChange(fn);
            enterFullscreen(element);
        }
        else {
            exitFullscreen();
            callback(false);
        }
        return Promise.resolve();
    }
    return new Promise(function (resolve) {
        if (!isFullscreen()) {
            enterFullscreen(element);
        }
        else {
            exitFullscreen();
        }
        resolve();
    });
    /**
     * enter fullscreen mode.
     * @param {Element} element
     */
    function enterFullscreen(element) {
        var userAgent = navigator.userAgent.toLowerCase();
        if (element.requestFullscreen) {
            element.requestFullscreen();
        }
        else if (element.msRequestFullscreen) {
            element.msRequestFullscreen();
        }
        else if (element.mozRequestFullScreen) {
            element.parentElement.mozRequestFullScreen();
        }
        else if (userAgent.indexOf('edge') != -1) {
            element.parentElement.webkitRequestFullscreen();
        }
        else if (element.webkitRequestFullscreen) {
            element.webkitRequestFullscreen();
        }
    }
    /**
     * exit fullscreen mode.
     */
    function exitFullscreen() {
        var _doument = document;
        if (document.exitFullscreen) {
            document.exitFullscreen();
        }
        else if (_doument.msExitFullscreen) {
            _doument.msExitFullscreen();
        }
        else if (_doument.mozCancelFullScreen) {
            _doument.mozCancelFullScreen();
        }
        else if (_doument.webkitExitFullscreen) {
            _doument.webkitExitFullscreen();
        }
    }
}
1277404
function fullscreenChange(callback) {
    var _document = document;
    return new Promise(function (resolve, reject) {
        if (document.fullscreenEnabled) {
            document.addEventListener('fullscreenchange', callback);
        }
        else if (_document.mozFullScreenEnabled) {
            _document.addEventListener('mozfullscreenchange', callback);
        }
        else if (_document.webkitFullscreenEnabled) {
            _document.addEventListener('webkitfullscreenchange', callback); //Safari
            _document.addEventListener('fullscreenChange', callback); // Edge
        }
        else if (_document.msFullscreenEnabled) {
            _document.addEventListener('MSFullscreenChange', callback);
        }
        else {
            reject();
        }
        resolve();
    });
}
1363708
def _context_menu_make(self, pos):
        """"""
        menu = super(ShellWidget, self)._context_menu_make(pos)
        return self.ipyclient.add_actions_to_context_menu(menu)
786370
function fullscreenchangeHandler() {
        viewerAPI.fire('fullscreenchange');
        if (isFullscreen()) {
            $el.addClass('crocodoc-fullscreen');
            viewerAPI.fire('fullscreenenter');
        } else {
            $el.removeClass('crocodoc-fullscreen');
            viewerAPI.fire('fullscreenexit');
        }
    }
727487
function onFullscreenClick() {
		if (requestFullscreen) {
			if (player === fullscreenElement()) {
				// exit fullscreen
				exitFullscreen().call(document);
			} else {
				// enter fullscreen
				requestFullscreen.call(player);

				// maintain focus in internet explorer
				self.fullscreen.focus();

				// maintain focus in safari
				setTimeout(() => {
					self.fullscreen.focus();
				}, 200);
			}
		} else if (media.webkitSupportsFullscreen) {
			// iOS allows fullscreen of the video itself
			if (media.webkitDisplayingFullscreen) {
				// exit ios fullscreen
				media.webkitExitFullscreen();
			} else {
				// enter ios fullscreen
				media.webkitEnterFullscreen();
			}

			onFullscreenChange();
		}
	}
1229061
def force_screen_saver(self, mode, onerror = None):
        """"""
        request.ForceScreenSaver(display = self.display,
                                 onerror = onerror,
                                 mode = mode)
487641
protected function _modeAdvanced()
    {
        if ($this->getToolbars() === null) {
            $this->setToolbars([
                'undo redo | cut copy paste pastetext | searchreplace | bold italic underline strikethrough | subscript superscript | alignleft aligncenter alignright alignjustify | fontselect fontsizeselect | forecolor backcolor',
                'styleselect | table | bullist numlist outdent indent blockquote | link unlink anchor | image media lioniteimages | preview fullscreen code | charmap visualchars nonbreaking inserttime hr'
            ]);
        }
        if ($this->getContextMenu() === null) {
            $this->setContextMenu('link image media inserttable | cell row column deletetable');
        }
    }
1163543
protected function _modeDefault()
    {
        if ($this->getToolbars() === null) {
            $this->setToolbars('undo redo | bold italic underline strikethrough | forecolor backcolor | styleselect | bullist numlist outdent indent | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | link unlink anchor | image media lioniteimages | preview');
        }
        if ($this->getContextMenu() === null) {
            $this->setContextMenu('link image media inserttable | cell row column deletetable');
        }
    }
280075
function setBlendMode(mode, context) {
         context = context || this.getContext();
         this.currentBlendMode = mode;

         switch (mode) {
           case "multiply":
             context.globalCompositeOperation = "multiply";
             break;

           default:
             // normal
             context.globalCompositeOperation = "source-over";
             this.currentBlendMode = "normal";
             break;
         }
       }
1202726
function tryFullscreen(shell) {
  //Request full screen
  var elem = shell.element
  
  if(shell._wantFullscreen && !shell._fullscreenActive) {
    var fs = elem.requestFullscreen ||
             elem.requestFullScreen ||
             elem.webkitRequestFullscreen ||
             elem.webkitRequestFullScreen ||
             elem.mozRequestFullscreen ||
             elem.mozRequestFullScreen ||
             function() {}
    fs.call(elem)
  }
  if(shell._wantPointerLock && !shell._pointerLockActive) {
    var pl =  elem.requestPointerLock ||
              elem.webkitRequestPointerLock ||
              elem.mozRequestPointerLock ||
              elem.msRequestPointerLock ||
              elem.oRequestPointerLock ||
              function() {}
    pl.call(elem)
  }
}
86838
def refresh_context(self):
        
        User = self.model('res.user')

        self.context = User.get_preferences(True)
        return self.context
172362
private void initializeFullscreenPreference() {
        Preference fullscreenPreference =
                findPreference(getString(R.string.fullscreen_preference_key));
        fullscreenPreference.setOnPreferenceChangeListener(createThemeChangeListener());
    }
1230350
function fullscreenchange () {
		var newEvent = document.createEvent('CustomEvent');
		newEvent.initCustomEvent('fullscreenchange', true, false, null);
		// TODO: Any need for variable copy?
		document.dispatchEvent(newEvent);
	}
75748
def mk_notebook_context_menu(callback_object):
    
    callback_object.context_menu = Gtk.Menu()
    menu = callback_object.context_menu
    mi = Gtk.MenuItem(_("New Tab"))
    mi.connect("activate", callback_object.on_new_tab)
    menu.add(mi)
    menu.add(Gtk.SeparatorMenuItem())
    mi = Gtk.MenuItem(_("Save Tabs"))
    mi.connect("activate", callback_object.on_save_tabs)
    menu.add(mi)
    mi = Gtk.MenuItem(_("Restore Tabs"))
    mi.connect("activate", callback_object.on_restore_tabs_with_dialog)
    menu.add(mi)
    menu.add(Gtk.SeparatorMenuItem())
    mi = Gtk.ImageMenuItem("gtk-preferences")
    mi.set_use_stock(True)
    mi.connect("activate", callback_object.on_show_preferences)
    menu.add(mi)
    mi = Gtk.ImageMenuItem("gtk-about")
    mi.set_use_stock(True)
    mi.connect("activate", callback_object.on_show_about)
    menu.add(mi)
    menu.add(Gtk.SeparatorMenuItem())
    mi = Gtk.MenuItem(_("Quit"))
    mi.connect("activate", callback_object.on_quit)
    menu.add(mi)
    menu.show_all()
    return menu