<commit_before>'use strict'

require('./protocol/greenfield-client-protocol')
const {Global} = require('wayland-server-bindings-runtime')
const util = require('util')

class ShimGlobal extends Global {
  static create (wlDisplay, name, interface_, version) {
    const wlGlobalClass = require(util.format('./protocol/wayland/%s', interface_.replace('Gr', 'Wl')))
    const localGlobalClass = require(util.format('./%s', interface_.replace('Gr', 'Local')))
    const shimGlobalClass = require(util.format('./%s', interface_.replace('Gr', 'Shim')))
    return new ShimGlobal(wlDisplay, wlGlobalClass, localGlobalClass, shimGlobalClass, name, interface_, version)
  }

  constructor (wlDisplay, wlGlobalClass, localGlobalClass, shimGlobalClass, name, interface_, version) {
    super(wlDisplay, wlGlobalClass.interface_, version)
    this._wlGlobalClass = wlGlobalClass
    this._localGlobalClass = localGlobalClass
    this._shimGlobalClass = shimGlobalClass
    this._name = name
    this._interface_ = interface_
    this._version = version
  }

  bind (wlClient, version, id) {
    try {
      // find matching proxy based on wayland wlClient pointer address
      const clientRegistryProxy = wlClient._clientRegistryProxy
      const globalProxy = clientRegistryProxy.bind(this._name, this._interface_, this._version)

      const localGlobal = this._localGlobalClass.create()
      globalProxy.listener = localGlobal
      const shimGlobal = this._shimGlobalClass.create(globalProxy)

      localGlobal.resource = this._wlGlobalClass.create(wlClient, version, id, shimGlobal, null)
    } catch (error) {
      console.log(error)
      process.exit(1)
    }
  }
}

module.exports = ShimGlobal<commit_msg>pass desired client version to bind call<commit_after>'use strict'

require('./protocol/greenfield-client-protocol')
const {Global} = require('wayland-server-bindings-runtime')
const util = require('util')

class ShimGlobal extends Global {
  static create (wlDisplay, name, interface_, version) {
    const wlGlobalClass = require(util.format('./protocol/wayland/%s', interface_.replace('Gr', 'Wl')))
    const localGlobalClass = require(util.format('./%s', interface_.replace('Gr', 'Local')))
    const shimGlobalClass = require(util.format('./%s', interface_.replace('Gr', 'Shim')))
    return new ShimGlobal(wlDisplay, wlGlobalClass, localGlobalClass, shimGlobalClass, name, interface_, version)
  }

  constructor (wlDisplay, wlGlobalClass, localGlobalClass, shimGlobalClass, name, interface_, version) {
    super(wlDisplay, wlGlobalClass.interface_, version)
    this._wlGlobalClass = wlGlobalClass
    this._localGlobalClass = localGlobalClass
    this._shimGlobalClass = shimGlobalClass
    this._seatName = name
    this._interface_ = interface_
  }

  bind (wlClient, version, id) {
    try {
      // find matching proxy based on wayland wlClient pointer address
      const clientRegistryProxy = wlClient._clientRegistryProxy
      const globalProxy = clientRegistryProxy.bind(this._seatName, this._interface_, version)

      const localGlobal = this._localGlobalClass.create()
      globalProxy.listener = localGlobal
      const shimGlobal = this._shimGlobalClass.create(globalProxy)

      localGlobal.resource = this._wlGlobalClass.create(wlClient, version, id, shimGlobal, null)
    } catch (error) {
      console.log(error)
      process.exit(1)
    }
  }
}

module.exports = ShimGlobal
{'fraction_non_alphanumeric': 0.11046000585994727, 'fraction_numerical': 0.0005859947260474656, 'mean_word_length': 4.453674121405751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4404536', 'n_tokens_mistral': 970, 'n_tokens_neox': 953, 'n_words': 219}