delegate to instance of Curses::Window
189372
def method_missing(name, *args)
      if @c_window.respond_to? name.to_s
        @c_window.send name.to_s, *args
      else
        super
      end
    end
191140
function delegate(req, res) {
  var cmd = req.info.command
    , method;

  if(!cmd.sub) {
    throw new Error('attempt to delegate with no subcommand info');
  }

  method = req.exec[cmd.sub.cmd];

  // subcommand is declared but the command exec handler
  // has not declared the method and is attempting to delegate
  // we treat this as unknown subcommand which allows partial
  // subcommand exec handlers that may call delegate but only
  // implement a subset of the declared subcommands
  if(typeof method !== 'function') {
    return res.send(StoreError.UnknownSubcommand);
  }

  // rewrite the cmd/args
  req.cmd = cmd.sub.cmd;
  req.args = cmd.sub.args;
  method.call(this, req, res);
}
893795
function delegate(callback, el) {
        var currentElement = el;

        do {
            if (!isClickTarget(currentElement)) continue;
            callback(currentElement);
            return;
        } while(currentElement.nodeName.toUpperCase() !== 'BODY' && (currentElement = currentElement.parentNode));
    }
400978
function () {
            // continue working in subwindow
            // var Aria = this._subWindow.Aria;
            var aria = this._subWindow.aria;
            // creates module instance first to be able to dispose it when window close
            var self = this;
            aria.templates.ModuleCtrlFactory.createModuleCtrl({
                classpath : this._config.moduleCtrlClasspath,
                autoDispose : false,
                initArgs : {
                    bridge : this
                }
            }, {
                fn : function (res) {
                    // For some obscure reason on IE 9 only, it is needed to put
                    // this closure here in order to call _moduleLoaded with
                    // the right scope:
                    self._moduleLoaded(res);
                },
                scope : this
            }, false);
        }
1267496
function clckHlpr(i) {
    addEvent(i, 'click', function (e) {
      stopPropagation(e);
      preventDefault(e);
      currGroup = getAttr(i, _const_dataattr + '-group') || false;
      currThumbnail = i;
      openBox(i, false, false, false);
    }, false);
  }
1157638
function (out) {

            if (!this._cfgOk) {
                return aria.widgets.TemplateBasedWidget.superclass.writeMarkup.call(this, out);
            }

            // Prepare delegation id before to have it linked with this widget
            this._tplWidget._delegateId = aria.utils.Delegate.add({
                fn : this.delegate,
                scope : this
            });
            this._tplWidget.writeMarkup(out);

            this._domReady = true;
        }
428114
def delegate(self, fn, *args, **kwargs):
        """"""
        return self.subexecutor.submit(fn, *args, **kwargs)
686319
def set_key_callback(window, cbfun):
    
    window_addr = ctypes.cast(ctypes.pointer(window),
                              ctypes.POINTER(ctypes.c_long)).contents.value
    if window_addr in _key_callback_repository:
        previous_callback = _key_callback_repository[window_addr]
    else:
        previous_callback = None
    if cbfun is None:
        cbfun = 0
    c_cbfun = _GLFWkeyfun(cbfun)
    _key_callback_repository[window_addr] = (cbfun, c_cbfun)
    cbfun = c_cbfun
    _glfw.glfwSetKeyCallback(window, cbfun)
    if previous_callback is not None and previous_callback[0] != 0:
        return previous_callback[0]
1048949
def from_top_left(from_window=nil, f=nil)
      if from_window.is_a?(Hash)
        f = from_window
        from_window = nil
      end
      f ||= {}
      from_window ||= target.screen || NSScreen.mainScreen
      _calculate_frame(f, from: from_window, relative_to: { x: :min, y: :max })
    end
1065698
def _delegate(self, path):
        # type: (Text) -> Optional[FS]
        
        for _name, fs in self.iterate_fs():
            if fs.exists(path):
                return fs
        return None
787503
function OutCtrl($scope, $location, $rootScope, $window, $timeout, $routeParams,
                 _bind, _modules, _req, _socket) {

  /****************************************************************************/
  /* INITIALIZATION                                                           */
  /****************************************************************************/
  /* Handhsaking */
  _socket.emit('tail', $routeParams.name);

  _socket.on('module', function(module) {
    $scope.module = module;
    $window.document.title = 'out::' + module.name;
  });

  $scope.data = '';
  _socket.on('chunk', function(chunk) {
    /* The same socket may receive events from multiple modules. */
    if($scope.module.name === chunk.module) {
      $scope.data += chunk.data;
    }
    /* Basically the socket stays open. TODO(spolu): FixMe */
    if($timeout && $('.wrapper') && $('.wrapper')[0]) {
      $timeout(function() {
        $('.wrapper').scrollTop($('.wrapper')[0].scrollHeight);
      });
    }
  });

  /****************************************************************************/
  /* COMMANDS                                                                  */
  /****************************************************************************/

  $scope.modules_restart = function(path) {
    /* On restart we clear the log buffer. */
    $scope.data = '';
    async.series([
      function(cb_) {
        _modules.kill(path).then(function(data) {
          return cb_();
        });
      },
      function(cb_) {
        _modules.run(path).then(function(data) {
          return cb_();
        });
      },
    ], function(err) {
    });
  };
}
779012
private void switchToWindow(String key, String handleToKeep) {
        Context.addWindow(key, handleToKeep);
        Context.setMainWindow(key);
        Context.getDriver().switchTo().window(handleToKeep);
    }
1367216
def _handle_windows(self, event):
        """"""
        vkey = self._keyname(event.GetKey())
        if event.Message in self.KEYS_UP + self.KEYS_DOWN:
            if vkey in self.MODIFIERNAMES:
                self._realmodifiers[vkey] = event.Message in self.KEYS_DOWN
                self._modifiers[self.MODIFIERNAMES[vkey]] = self._realmodifiers[vkey]
        if event.Message not in self.KEYS_DOWN:
            return True

        is_altgr = False
        if (vkey, event.IsExtended()) in self.NUMPAD_SPECIALS:
            key = vkey = "Numpad-" + vkey
        elif not event.Ascii or vkey.startswith("Numpad"):
            key = vkey
        else:
            is_altgr = event.Ascii in self.ALT_GRS
            key = self._keyname(unichr(event.Ascii))

        if DEBUG: print("Adding key %s (real %s)" % (key.encode("utf-8"), vkey.encode("utf-8")))
        self._output(type="keys", key=key, realkey=vkey)

        if vkey not in self.MODIFIERNAMES and not is_altgr:
            modifier = "-".join(k for k in ["Ctrl", "Alt", "Shift", "Win"]
                                if self._modifiers[k])
            if modifier and modifier != "Shift": # Shift-X is not a combo
                if self._modifiers["Ctrl"] and event.Ascii:
                    key = self._keyname(unichr(event.KeyID))
                realmodifier = "-".join(k for k, v in self._realmodifiers.items() if v)
                realkey = "%s-%s" % (realmodifier, key)
                key = "%s-%s" % (modifier, key)
                if DEBUG: print("Adding combo %s (real %s)" % (key.encode("utf-8"), realkey.encode("utf-8")))
                self._output(type="combos", key=key, realkey=realkey)

        if DEBUG:
            print("CHARACTER: %r" % key)
            print('GetKey: {0}'.format(event.GetKey()))  # Name of the virtual keycode, str
            print('IsAlt: {0}'.format(event.IsAlt()))  # Was the alt key depressed?, bool
            print('IsExtended: {0}'.format(event.IsExtended()))  # Is this an extended key?, bool
            print('IsInjected: {0}'.format(event.IsInjected()))  # Was this event generated programmatically?, bool
            print('IsTransition: {0}'.format(event.IsTransition()))  #Is this a transition from up to down or vice versa?, bool
            print('ASCII: {0}'.format(event.Ascii))  # ASCII value, if one exists, str
            print('KeyID: {0}'.format(event.KeyID))  # Virtual key code, int
            print('ScanCode: {0}'.format(event.ScanCode))  # Scan code, int
            print('Message: {0}'.format(event.Message))  # Name of the virtual keycode, str
            print()
        return True
1098631
def _delegate(from_owner, to_owner, method):
  
  dgate = lambda self, *args, **kwargs: getattr(getattr(self, to_owner), method)(*args, **kwargs)
  dgate.__name__ = method
  dgate.__doc__ = "Delegates to {0}.{1}: {2}".format(to_owner, method, method.__doc__)
  setattr(from_owner, method, dgate)
721134
def delegate(self, fn, *args, **kwargs):
        """"""
        return self.subexecutor.spawn(fn, *args, **kwargs)
355493
def cmd(self, fun, arg=None, pub_data=None, kwarg=None, print_event=True, full_return=False):
        '''
        
        '''
        return super(WheelClient, self).cmd(fun,
                                            arg,
                                            pub_data,
                                            kwarg,
                                            print_event,
                                            full_return)
1046965
def do_windowed(self, arg):
        
        if self.cmdprefix:
            raise CmdError("prefix not allowed")
        cmdline = self.input_command_line(arg)
        try:
            process = self.debug.execl(arg,
                                                bConsole = False,
                                                 bFollow = self.options.follow)
            print("Spawned process (%d)" % process.get_pid())
        except Exception:
            raise CmdError("can't execute")
        self.set_fake_last_event(process)