<commit_before>// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin
// +build 386 amd64

package gldriver

// #include "cocoa.h"
import "C"

import (
	"fmt"
	"image"
	"sync"

	"golang.org/x/exp/shiny/screen"
	"golang.org/x/mobile/event/paint"
)

type screenImpl struct {
	mu      sync.Mutex
	windows map[uintptr]*windowImpl
}

func (s *screenImpl) NewBuffer(size image.Point) (retBuf screen.Buffer, retErr error) {
	return &bufferImpl{
		rgba: image.NewRGBA(image.Rectangle{Max: size}),
		size: size,
	}, nil
}

func (s *screenImpl) NewTexture(size image.Point) (screen.Texture, error) {
	return nil, fmt.Errorf("NewTexture not implemented")
}

func (s *screenImpl) NewWindow(opts *screen.NewWindowOptions) (screen.Window, error) {
	// TODO: look at opts.
	const width, height = 512, 384

	id := C.newWindow(width, height)
	w := &windowImpl{
		s:         s,
		id:        uintptr(id),
		eventsIn:  make(chan interface{}),
		eventsOut: make(chan interface{}),
		endPaint:  make(chan paint.Event, 1),
		draw:      make(chan struct{}),
		drawDone:  make(chan struct{}),
	}<commit_msg>shiny/driver/gldriver: make the default window size consistent with x11.<commit_after>// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build darwin
// +build 386 amd64

package gldriver

// #include "cocoa.h"
import "C"

import (
	"fmt"
	"image"
	"sync"

	"golang.org/x/exp/shiny/screen"
	"golang.org/x/mobile/event/paint"
)

type screenImpl struct {
	mu      sync.Mutex
	windows map[uintptr]*windowImpl
}

func (s *screenImpl) NewBuffer(size image.Point) (retBuf screen.Buffer, retErr error) {
	return &bufferImpl{
		rgba: image.NewRGBA(image.Rectangle{Max: size}),
		size: size,
	}, nil
}

func (s *screenImpl) NewTexture(size image.Point) (screen.Texture, error) {
	return nil, fmt.Errorf("NewTexture not implemented")
}

func (s *screenImpl) NewWindow(opts *screen.NewWindowOptions) (screen.Window, error) {
	// TODO: look at opts.
	const width, height = 1024, 768

	id := C.newWindow(width, height)
	w := &windowImpl{
		s:         s,
		id:        uintptr(id),
		eventsIn:  make(chan interface{}),
		eventsOut: make(chan interface{}),
		endPaint:  make(chan paint.Event, 1),
		draw:      make(chan struct{}),
		drawDone:  make(chan struct{}),
	}
{'fraction_non_alphanumeric': 0.13614262560777957, 'fraction_numerical': 0.014181523500810372, 'mean_word_length': 3.748076923076923, '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': '4716061', 'n_tokens_mistral': 920, 'n_tokens_neox': 856, 'n_words': 252}