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

#include "webkit/glue/webkit_glue.h"

#include <gtk/gtk.h>

#include "webkit/glue/screen_info.h"

namespace webkit_glue {

ScreenInfo GetScreenInfoHelper(gfx::NativeView window) {
  GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(window));
  GdkVisual* visual = gdk_screen_get_system_visual(screen);

  ScreenInfo results;
  results.rect.SetRect(0, 0, gdk_screen_get_width(screen),
                       gdk_screen_get_height(screen));
  // I don't know of a way to query the "maximise" size of the window (e.g.
  // screen size less sidebars etc) since this is something which only the
  // window manager knows.
  results.available_rect = results.rect;

  results.depth = visual->depth;
  results.depth_per_component = visual->bits_per_rgb;

  results.is_monochrome = false;

  return results;
}

}  // namespace webkit_glue<commit_msg>Linux: fix crash when getting the screen info for a NULL window.<commit_after>// Copyright (c) 2008 The Chromium Authors. All rights reserved.  Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.

#include "webkit/glue/webkit_glue.h"

#include <gtk/gtk.h>

#include "webkit/glue/screen_info.h"

namespace webkit_glue {

ScreenInfo GetScreenInfoHelper(gfx::NativeView window) {
  ScreenInfo results;
  results.depth = 32;
  results.depth_per_component = 8;
  results.is_monochrome = false;

  if (!window)
    return results;

  GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(window));
  results.rect.SetRect(0, 0, gdk_screen_get_width(screen),
                       gdk_screen_get_height(screen));
  // I don't know of a way to query the "maximise" size of the window (e.g.
  // screen size less sidebars etc) since this is something which only the
  // window manager knows.
  results.available_rect = results.rect;

  return results;
}

}  // namespace webkit_glue
{'fraction_non_alphanumeric': 0.0948905109489051, 'fraction_numerical': 0.0072992700729927005, 'mean_word_length': 3.8262910798122065, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2206336', 'n_tokens_mistral': 691, 'n_tokens_neox': 656, 'n_words': 199}