Virtual keyborad may get small d.info['displayHeight']
970553
def display(self):
        
        for line in self.adb_shell('dumpsys display').splitlines():
            m = _DISPLAY_RE.search(line, 0)
            if not m:
                continue
            w = int(m.group('width'))
            h = int(m.group('height'))
            return collections.namedtuple('Display', ['width', 'height'])(w, h)
        else:
            w, h = self.info['displayWidth'], self.info['displayHeight']
            return collections.namedtuple('Display', ['width', 'height'])(w, h)
198373
def isKeyboardShown(self):
        '''
        
        '''

        self.__checkTransport()
        dim = self.shell('dumpsys input_method')
        if dim:
            # FIXME: API >= 15 ?
            return "mInputShown=true" in dim
        return False
1104730
def dim(self, dim):
        
        # Assume dim display.
        contrast = 0
        # Adjust contrast based on VCC if not dimming.
        if not dim:
            if self._vccstate == SSD1306_EXTERNALVCC:
                contrast = 0x9F
            else:
                contrast = 0xCF
1085312
def X_less(self):
        """"""
        self.parent.value('window_length',
                          self.parent.value('window_length') / 2)
        self.parent.overview.update_position()
726828
def get_text_width_height_descent(self, s, prop, ismath):
        
        #return 1, 1
        if ismath: s = self.strip_math(s)

        if self.gc is None:
            gc = self.new_gc()
        else:
            gc = self.gc
        gfx_ctx = gc.gfx_ctx
        font = self.get_wx_font(s, prop)
        gfx_ctx.SetFont(font, wx.BLACK)
        w, h, descent, leading = gfx_ctx.GetFullTextExtent(s)

        return w, h, descent
1038061
function secondaryToolbarSetMaxHeight(container) {
    if (!container || !this.buttonContainer) {
      return;
    }
    this.newContainerHeight = container.clientHeight;
    if (this.previousContainerHeight === this.newContainerHeight) {
      return;
    }
    this.buttonContainer.setAttribute('style',
      'max-height: ' + (this.newContainerHeight - SCROLLBAR_PADDING) + 'px;');
    this.previousContainerHeight = this.newContainerHeight;
  }
990916
function calcAvailableHeight() {
        var availableHt = $windowContent.height();

        $editorHolder.siblings().each(function (i, elem) {
            var $elem = $(elem);
            if ($elem.css("display") !== "none" && $elem.css("position") !== "absolute") {
                availableHt -= $elem.outerHeight();
            }
        });

        // Clip value to 0 (it could be negative if a panel wants more space than we have)
        return Math.max(availableHt, 0);
    }
1022071
function Flyout_checkKeyboardFit() {
                    // Special Flyout positioning rules to determine if the Flyout needs to adjust its
                    // position because of the IHM. If the Flyout needs to adjust for the IHM, it will reposition
                    // itself to be pinned to either the top or bottom edge of the visual viewport.
                    // - Too Tall, above top, or below bottom.

                    var keyboardMovedUs = false;
                    var viewportHeight = _Overlay._Overlay._keyboardInfo._visibleDocHeight;
                    var adjustedMarginBoxHeight = this._currentPosition.contentHeight + this._currentPosition.verticalMarginBorderPadding;
                    if (adjustedMarginBoxHeight > viewportHeight) {
                        // The Flyout is now too tall to fit in the viewport, pin to top and adjust height.
                        keyboardMovedUs = true;
                        this._currentPosition.top = _Constants.pinToBottomEdge;
                        this._currentPosition.contentHeight = viewportHeight - this._currentPosition.verticalMarginBorderPadding;
                        this._currentPosition.doesScroll = true;
                    } else if (this._currentPosition.top >= 0 &&
                        this._currentPosition.top + adjustedMarginBoxHeight > _Overlay._Overlay._keyboardInfo._visibleDocBottom) {
                        // Flyout clips the bottom of the viewport. Pin to bottom.
                        this._currentPosition.top = _Constants.pinToBottomEdge;
                        keyboardMovedUs = true;
                    } else if (this._currentPosition.top === _Constants.pinToBottomEdge) {
                        // We were already pinned to the bottom, so our position on screen will change
                        keyboardMovedUs = true;
                    }

                    // Signals use of basic fadein animation
                    this._keyboardMovedUs = keyboardMovedUs;
                }
377097
public void setHeight(int height) {

        if (height <= 0) {
            m_containerElement.getStyle().clearWidth();
            m_main.getStyle().clearHeight();
        } else {
            int contentHeight = height - 6;
            if (hasCaption()) {
                contentHeight = contentHeight - 36;
            }
            if (hasButtons()) {
                contentHeight = contentHeight - 34;
            }
            contentHeight = contentHeight - m_contentHeightCorrection;
            m_main.getStyle().setHeight(contentHeight, Unit.PX);
        }
    }
703312
def get_above_key_rect(self):
        """"""

        key_above = self.row - 1, self.col, self.tab

        border_width_bottom = \
            float(self.cell_attributes[key_above]["borderwidth_bottom"]) / 2.0

        rect_above = (self.x, self.y-border_width_bottom,
                      self.width, border_width_bottom)
        return key_above, rect_above
466580
function getContentDimensions(instance) {
    const contentElement = instance._root.firstElementChild
    if (!contentElement) {
      return {
        width: 0,
        height: 0,
      }
    }

    let width
    let height
    if (window.devicePixelRatio > 1) {
      // This is much less performant, so we use in only on HiDPi displays
      const bounds = contentElement.getBoundingClientRect()
      width = bounds.width
      height = bounds.height
    } else {
      width = contentElement.scrollWidth
      height = contentElement.scrollHeight
    }

    return {
      width,
      height,
    }
  }
1371571
private void obtainMaxHeight(@StyleRes final int themeResourceId) {
        TypedArray typedArray = getContext().getTheme()
                .obtainStyledAttributes(themeResourceId, new int[]{R.attr.materialDialogMaxHeight});
        int defaultValue;

        try {
            defaultValue =
                    getContext().getResources().getDimensionPixelSize(R.dimen.dialog_max_height);
        } catch (Resources.NotFoundException | UnsupportedOperationException e) {
            defaultValue = -1;
        }

        try {
            setMaxHeight(typedArray.getDimensionPixelSize(0, defaultValue));
        } catch (Resources.NotFoundException | UnsupportedOperationException e) {
            setMaxHeight(-1);
        }
    }
807393
function getDomains (display, height, width, bounds, options) {
  var xmin = bounds[0][0]
  var xmax = bounds[1][0]
  var ymin = bounds[0][1]
  var ymax = bounds[1][1]
  var xRange = xmax - xmin
  var yRange = ymax - ymin

  var paddingFactor = (options && options.paddingFactor)
    ? options.paddingFactor
    : 0.1

  var margins = getMargins(options)

  var usableHeight = height - margins.top - margins.bottom
  var usableWidth = width - margins.left - margins.right
  var displayAspect = width / height
  var usableDisplayAspect = usableWidth / usableHeight
  var graphAspect = xRange / (yRange === 0 ? -Infinity : yRange)

  var padding
  var dispX1, dispX2, dispY1, dispY2
  var dispXRange, dispYRange

  if (usableDisplayAspect > graphAspect) { // y-axis is limiting
    padding = paddingFactor * yRange
    dispY1 = ymin - padding
    dispY2 = ymax + padding
    dispYRange = yRange + 2 * padding
    var addedYRange = (height / usableHeight * dispYRange) - dispYRange
    if (margins.top > 0 || margins.bottom > 0) {
      dispY1 -= margins.bottom / (margins.bottom + margins.top) * addedYRange
      dispY2 += margins.top / (margins.bottom + margins.top) * addedYRange
    }
    dispXRange = (dispY2 - dispY1) * displayAspect
    var xOffset = (margins.left - margins.right) / width
    var xMidpoint = (xmax + xmin - dispXRange * xOffset) / 2
    dispX1 = xMidpoint - dispXRange / 2
    dispX2 = xMidpoint + dispXRange / 2
  } else { // x-axis limiting
    padding = paddingFactor * xRange
    dispX1 = xmin - padding
    dispX2 = xmax + padding
    dispXRange = xRange + 2 * padding
    var addedXRange = (width / usableWidth * dispXRange) - dispXRange
    if (margins.left > 0 || margins.right > 0) {
      dispX1 -= margins.left / (margins.left + margins.right) * addedXRange
      dispX2 += margins.right / (margins.left + margins.right) * addedXRange
    }

    dispYRange = (dispX2 - dispX1) / displayAspect
    var yOffset = (margins.bottom - margins.top) / height
    var yMidpoint = (ymax + ymin - dispYRange * yOffset) / 2
    dispY1 = yMidpoint - dispYRange / 2
    dispY2 = yMidpoint + dispYRange / 2
  }

  return [
    [dispX1, dispX2],
    [dispY1, dispY2]
  ]
}
533700
def on_resize(self, *args):
        """"""
        # pylint: disable=W0613
        #         Unused argument 'args'
        self.screen.style.name_len = min(self.screen.style.name_len,
                                         self.term.width - 15)
        assert self.term.width >= self.screen.hint_width, (
            'Screen to small {}, must be at least {}'.format(
                self.term.width, self.screen.hint_width))
        self._set_lastpage()
        self.dirty = self.STATE_REFRESH
41474
def _get_key_info(self):
        ""

        # copied more or less verbatim from
        # http://www.pinvoke.net/default.aspx/user32.sendinput
        if (
            (self.key >= 33 and self.key <= 46) or
            (self.key >= 91 and self.key <= 93) ):
            flags = KEYEVENTF_EXTENDEDKEY;
        else:
            flags = 0
        # This works for %{F4} - ALT + F4
        #return self.key, 0, 0

        # this works for Tic Tac Toe i.e. +{RIGHT} SHIFT + RIGHT
        return self.key, MapVirtualKey(self.key, 0), flags
760852
def dim(self):
        """"""
        dim_command = StandardSend(
            self._address, COMMAND_LIGHT_DIM_ONE_STEP_0X16_0X00)
        self._send_method(dim_command)
1342132
function (cfg) {
            var size = {}, totalHeight, initDimension, skinObj = this._skinObj;

            this._panelBorderH = this._calculateBorderSize(skinObj.panelBorder, "H");
            this._panelBorderV = this._calculateBorderSize(skinObj.panelBorder, "V");

            this._separatorBorderH = this._calculateBorderSize(skinObj.separatorBorder, "H");
            this._separatorBorderV = this._calculateBorderSize(skinObj.separatorBorder, "V");

            if (cfg.border) {
                this._containerBorderH = (skinObj.borderWidth || skinObj.borderWidth === 0)
                        ? skinObj.borderWidth * 2
                        : this._skinObj.borderTopWidth + this._skinObj.borderBottomWidth;
                this._containerBorderV = (skinObj.borderWidth || skinObj.borderWidth === 0)
                        ? skinObj.borderWidth * 2
                        : this._skinObj.borderLeftWidth + this._skinObj.borderRightWidth;
            }

            this._height = cfg.height - skinObj.separatorHeight - this._separatorBorderH - this._panelBorderH * 2
                    - this._containerBorderH;
            this._width = cfg.width - skinObj.separatorWidth - this._separatorBorderV - this._panelBorderV * 2
                    - this._containerBorderV;

            if (this._height < 0) {
                this._height = 0;
            }
            if (this._width < 0) {
                this._width = 0;
            }

            if (cfg.size1 < 0) {
                cfg.size1 = 0;
            }
            if (cfg.size2 < 0) {
                cfg.size2 = 0;
            }

            initDimension = this._orientation ? this._height : this._width;
            if (cfg.size1 == null && cfg.size2 == null) {
                cfg.size1 = Math.floor(initDimension / 2);
                cfg.size2 = initDimension - cfg.size1;
            } else if (cfg.size1 == null && cfg.size2 != null) {
                cfg.size1 = initDimension - cfg.size2;
            } else if (cfg.size1 != null && cfg.size2 == null) {
                cfg.size2 = initDimension - cfg.size1;
            }

            totalHeight = cfg.size1 + cfg.size2;
            if (initDimension == totalHeight) {
                size.size1 = cfg.size1;
                size.size2 = cfg.size2;
            } else {
                if (cfg.adapt == "size1") {
                    size.size2 = cfg.size2;
                    if (size.size2 > initDimension) {
                        size.size2 = initDimension;
                    }
                    size.size1 = initDimension - size.size2;
                } else if (cfg.adapt == "size2") {
                    size.size1 = cfg.size1;
                    if (size.size1 > initDimension) {
                        size.size1 = initDimension;
                    }
                    size.size2 = initDimension - size.size1;
                } else {
                    if (totalHeight !== 0) {
                        size.size1 = Math.floor((initDimension * cfg.size1) / totalHeight);
                        size.size2 = initDimension - size.size1;
                    } else {
                        size.size1 = Math.floor(initDimension / 2);
                        size.size2 = initDimension - cfg.size1;
                    }

                }
            }
            return size;
        }