Skip to content

Commit

Permalink
Rename libgtkui to gtk
Browse files Browse the repository at this point in the history
The name "libgtkui" is misleading: we don't actually ship a
libgtkui.so, although this was planned at some point. Even if we did,
it probably still wouldn't make sense to have "lib" in the directory
name. This change renames the directory to simply gtk.

BUG=None
R=sky

Change-Id: Ib2380520c8605b4d4e0fd2d6ff9207caa50a406e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2011683
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734325}
  • Loading branch information
tanderson-google authored and Commit Bot committed Jan 23, 2020
1 parent 5d02b18 commit 5630ac2
Show file tree
Hide file tree
Showing 41 changed files with 233 additions and 232 deletions.
4 changes: 2 additions & 2 deletions build/config/linux/gtk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ group("gtk") {
"//remoting/host:remoting_me2me_host_static",
"//remoting/test:it2me_standalone_host_main",
"//webrtc/examples:peerconnection_client",
"//chrome/browser/ui/libgtkui:*",
"//chrome/browser/ui/gtk:*",
]

public_configs = [ ":gtk_internal_config" ]
Expand All @@ -48,6 +48,6 @@ pkg_config("gtkprint_internal_config") {
}

group("gtkprint") {
visibility = [ "//chrome/browser/ui/libgtkui:*" ]
visibility = [ "//chrome/browser/ui/gtk:*" ]
public_configs = [ ":gtkprint_internal_config" ]
}
2 changes: 1 addition & 1 deletion chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4333,7 +4333,7 @@ jumbo_static_library("browser") {
"//ui/snapshot",
]
if (use_gtk) {
deps += [ "//chrome/browser/ui/libgtkui" ]
deps += [ "//chrome/browser/ui/gtk" ]
}
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,7 @@ jumbo_static_library("ui") {
}
if (use_gtk) {
# This is the only component that can interact with gtk.
deps += [ "//chrome/browser/ui/libgtkui" ]
deps += [ "//chrome/browser/ui/gtk" ]
}
}

Expand Down Expand Up @@ -3455,7 +3455,7 @@ jumbo_static_library("ui") {
sources += [ "views/linux_ui/linux_ui_factory_gtk.cc" ]

# This is the only component that can interact with gtk.
deps += [ "//chrome/browser/ui/libgtkui" ]
deps += [ "//chrome/browser/ui/gtk" ]
} else {
sources += [ "views/linux_ui/linux_ui_factory.cc" ]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import("//build/config/linux/gtk/gtk.gni")
import("//printing/buildflags/buildflags.gni")
import("//ui/ozone/ozone.gni")

jumbo_component("libgtkui") {
jumbo_component("gtk") {
sources = [
"gtk_key_bindings_handler.cc",
"gtk_key_bindings_handler.h",
Expand Down Expand Up @@ -52,7 +52,7 @@ jumbo_component("libgtkui") {
configs += [ "//printing:cups" ]
}

defines = [ "IS_LIBGTKUI_IMPL" ]
defines = [ "IS_GTK_IMPL" ]

deps = [
"//base",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/libgtkui/gtk_event_loop_x11.h"
#include "chrome/browser/ui/gtk/gtk_event_loop_x11.h"

#include "ui/gfx/x/x11.h"

Expand All @@ -11,11 +11,11 @@
#include <gtk/gtk.h>

#include "base/memory/singleton.h"
#include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/x/x11_types.h"

namespace libgtkui {
namespace gtk {

// static
GtkEventLoopX11* GtkEventLoopX11::GetInstance() {
Expand Down Expand Up @@ -83,4 +83,4 @@ void GtkEventLoopX11::ProcessGdkEventKey(const GdkEventKey& gdk_event_key) {
XPutBackEvent(x_event.xkey.display, &x_event);
}

} // namespace libgtkui
} // namespace gtk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_EVENT_LOOP_X11_H_
#define CHROME_BROWSER_UI_LIBGTKUI_GTK_EVENT_LOOP_X11_H_
#ifndef CHROME_BROWSER_UI_GTK_GTK_EVENT_LOOP_X11_H_
#define CHROME_BROWSER_UI_GTK_GTK_EVENT_LOOP_X11_H_

#include "base/macros.h"
#include "ui/base/glib/glib_integers.h"
Expand All @@ -16,7 +16,7 @@ template <typename Type>
struct DefaultSingletonTraits;
}

namespace libgtkui {
namespace gtk {

class GtkEventLoopX11 {
public:
Expand All @@ -34,6 +34,6 @@ class GtkEventLoopX11 {
DISALLOW_COPY_AND_ASSIGN(GtkEventLoopX11);
};

} // namespace libgtkui
} // namespace gtk

#endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_EVENT_LOOP_X11_H_
#endif // CHROME_BROWSER_UI_GTK_GTK_EVENT_LOOP_X11_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/libgtkui/gtk_key_bindings_handler.h"
#include "chrome/browser/ui/gtk/gtk_key_bindings_handler.h"

#include <gdk/gdkkeysyms.h>
#include <stddef.h>
Expand All @@ -12,7 +12,7 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/base/ime/text_edit_commands.h"
#include "ui/events/event.h"
Expand All @@ -23,7 +23,7 @@ using ui::TextEditCommand;
// in a state that links. This code was adapted from the content layer GTK
// code, which had some simple unit tests. However, the changes in the public
// interface basically meant the tests need to be rewritten; this imposes weird
// linking requirements regarding GTK+ as we don't have a libgtkui_unittests
// linking requirements regarding GTK+ as we don't have a gtk_unittests
// yet. http://crbug.com/358297.

namespace {
Expand All @@ -38,7 +38,7 @@ GtkWidget* CreateInvisibleWindow() {

} // namespace

namespace libgtkui {
namespace gtk {

GtkKeyBindingsHandler::GtkKeyBindingsHandler()
: fake_window_(CreateInvisibleWindow()), handler_(CreateNewHandler()) {
Expand Down Expand Up @@ -185,7 +185,8 @@ void GtkKeyBindingsHandler::DeleteFromCursor(GtkTextView* text_view,
return;

TextEditCommand commands[2] = {
TextEditCommand::INVALID_COMMAND, TextEditCommand::INVALID_COMMAND,
TextEditCommand::INVALID_COMMAND,
TextEditCommand::INVALID_COMMAND,
};
switch (type) {
case GTK_DELETE_CHARS:
Expand Down Expand Up @@ -395,4 +396,4 @@ void GtkKeyBindingsHandler::MoveFocus(GtkWidget* widget,
// Just for disabling the default handler.
}

} // namespace libgtkui
} // namespace gtk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_KEY_BINDINGS_HANDLER_H_
#define CHROME_BROWSER_UI_LIBGTKUI_GTK_KEY_BINDINGS_HANDLER_H_
#ifndef CHROME_BROWSER_UI_GTK_GTK_KEY_BINDINGS_HANDLER_H_
#define CHROME_BROWSER_UI_GTK_GTK_KEY_BINDINGS_HANDLER_H_

#include <gtk/gtk.h>

Expand All @@ -17,7 +17,7 @@ namespace ui {
class Event;
}

namespace libgtkui {
namespace gtk {

// This class is a convenience class for handling editor key bindings defined
// in gtk keyboard theme.
Expand Down Expand Up @@ -137,6 +137,6 @@ class GtkKeyBindingsHandler {
std::vector<ui::TextEditCommandAuraLinux> edit_commands_;
};

} // namespace libgtkui
} // namespace gtk

#endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_KEY_BINDINGS_HANDLER_H_
#endif // CHROME_BROWSER_UI_GTK_GTK_KEY_BINDINGS_HANDLER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/libgtkui/gtk_ui.h"
#include "chrome/browser/ui/gtk/gtk_ui.h"

#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
Expand All @@ -23,15 +23,15 @@
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/libgtkui/gtk_key_bindings_handler.h"
#include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "chrome/browser/ui/libgtkui/input_method_context_impl_gtk.h"
#include "chrome/browser/ui/libgtkui/native_theme_gtk.h"
#include "chrome/browser/ui/libgtkui/nav_button_provider_gtk.h"
#include "chrome/browser/ui/libgtkui/print_dialog_gtk.h"
#include "chrome/browser/ui/libgtkui/printing_gtk_util.h"
#include "chrome/browser/ui/libgtkui/select_file_dialog_impl.h"
#include "chrome/browser/ui/libgtkui/settings_provider_gtk.h"
#include "chrome/browser/ui/gtk/gtk_key_bindings_handler.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/browser/ui/gtk/input_method_context_impl_gtk.h"
#include "chrome/browser/ui/gtk/native_theme_gtk.h"
#include "chrome/browser/ui/gtk/nav_button_provider_gtk.h"
#include "chrome/browser/ui/gtk/print_dialog_gtk.h"
#include "chrome/browser/ui/gtk/printing_gtk_util.h"
#include "chrome/browser/ui/gtk/select_file_dialog_impl.h"
#include "chrome/browser/ui/gtk/settings_provider_gtk.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "printing/buildflags/buildflags.h"
Expand Down Expand Up @@ -64,11 +64,11 @@
#include "ui/views/linux_ui/window_button_order_observer.h"

#if defined(USE_GIO)
#include "chrome/browser/ui/libgtkui/settings_provider_gsettings.h"
#include "chrome/browser/ui/gtk/settings_provider_gsettings.h"
#endif

#if defined(USE_GTK_EVENT_LOOP_X11)
#include "chrome/browser/ui/libgtkui/gtk_event_loop_x11.h"
#include "chrome/browser/ui/gtk/gtk_event_loop_x11.h"
#endif

#if defined(USE_X11)
Expand All @@ -86,7 +86,7 @@
#include "chrome/browser/ui/views/nav_button_provider.h"
#endif

namespace libgtkui {
namespace gtk {

namespace {

Expand Down Expand Up @@ -685,8 +685,7 @@ void GtkUi::SetWindowFrameAction(WindowFrameActionSource source,
std::unique_ptr<ui::LinuxInputMethodContext> GtkUi::CreateInputMethodContext(
ui::LinuxInputMethodContextDelegate* delegate,
bool is_simple) const {
return std::unique_ptr<ui::LinuxInputMethodContext>(
new InputMethodContextImplGtk(delegate, is_simple));
return std::make_unique<InputMethodContextImplGtk>(delegate, is_simple);
}

gfx::FontRenderParams GtkUi::GetDefaultFontRenderParams() const {
Expand Down Expand Up @@ -750,7 +749,7 @@ bool GtkUi::AnimationsEnabled() const {
#if BUILDFLAG(ENABLE_NATIVE_WINDOW_NAV_BUTTONS)
std::unique_ptr<views::NavButtonProvider> GtkUi::CreateNavButtonProvider() {
if (GtkVersionCheck(3, 14))
return std::make_unique<libgtkui::NavButtonProviderGtk>();
return std::make_unique<gtk::NavButtonProviderGtk>();
return nullptr;
}
#endif
Expand Down Expand Up @@ -1121,8 +1120,8 @@ float GtkUi::GetDeviceScaleFactor() const {
return device_scale_factor_;
}

} // namespace libgtkui
} // namespace gtk

views::LinuxUI* BuildGtkUi() {
return new libgtkui::GtkUi;
return new gtk::GtkUi;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_LIBGTKUI_GTK_UI_H_
#define CHROME_BROWSER_UI_LIBGTKUI_GTK_UI_H_
#ifndef CHROME_BROWSER_UI_GTK_GTK_UI_H_
#define CHROME_BROWSER_UI_GTK_GTK_UI_H_

#include <map>
#include <memory>
Expand All @@ -25,7 +25,7 @@ typedef struct _GtkSettings GtkSettings;
typedef struct _GtkStyle GtkStyle;
typedef struct _GtkWidget GtkWidget;

namespace libgtkui {
namespace gtk {
using ColorMap = std::map<int, SkColor>;

class GtkKeyBindingsHandler;
Expand Down Expand Up @@ -212,9 +212,9 @@ class GtkUi : public views::LinuxUI {
DISALLOW_COPY_AND_ASSIGN(GtkUi);
};

} // namespace libgtkui
} // namespace gtk

// Access point to the GTK desktop system.
COMPONENT_EXPORT(LIBGTKUI) views::LinuxUI* BuildGtkUi();
COMPONENT_EXPORT(GTK) views::LinuxUI* BuildGtkUi();

#endif // CHROME_BROWSER_UI_LIBGTKUI_GTK_UI_H_
#endif // CHROME_BROWSER_UI_GTK_GTK_UI_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/libgtkui/gtk_util.h"
#include "chrome/browser/ui/gtk/gtk_util.h"

#include <dlfcn.h>
#include <gdk/gdk.h>
Expand Down Expand Up @@ -43,7 +43,7 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line) {
// Callers should have already called setlocale(LC_ALL, "") and
// setlocale(LC_NUMERIC, "C") by now. Chrome does this in
// service_manager::Main.
DCHECK_EQ(strcmp(setlocale(LC_NUMERIC, NULL), "C"), 0);
DCHECK_EQ(strcmp(setlocale(LC_NUMERIC, nullptr), "C"), 0);
// This prevent GTK from calling setlocale(LC_ALL, ""), which potentially
// overwrites the LC_NUMERIC locale to something other than "C".
gtk_disable_setlocale();
Expand All @@ -52,7 +52,7 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line) {
#else
const std::vector<std::string>& args = command_line.argv();
int argc = args.size();
std::unique_ptr<char* []> argv(new char*[argc + 1]);
std::unique_ptr<char*[]> argv(new char*[argc + 1]);
for (size_t i = 0; i < args.size(); ++i) {
// TODO(piman@google.com): can gtk_init modify argv? Just being safe
// here.
Expand Down Expand Up @@ -126,7 +126,7 @@ int GetKeyEventProperty(const ui::KeyEvent& key_event,

} // namespace

namespace libgtkui {
namespace gtk {

// TODO(thomasanderson): ThemeService has a whole interface just for reading
// default constants. Figure out what to do with that more long term; for now,
Expand Down Expand Up @@ -205,7 +205,7 @@ float GetDeviceScaleFactor() {

void* GetGtkSharedLibrary() {
std::string lib_name =
"libgtk-" + std::to_string(GTK_MAJOR_VERSION) + ".so.0";
"libgtk-" + base::NumberToString(GTK_MAJOR_VERSION) + ".so.0";
static void* gtk_lib = dlopen(lib_name.c_str(), RTLD_LAZY);
DCHECK(gtk_lib);
return gtk_lib;
Expand Down Expand Up @@ -599,7 +599,7 @@ std::string GetGtkSettingsStringProperty(GtkSettings* settings,
GdkDisplay* GetGdkDisplay() {
GdkDisplay* display = nullptr;
// TODO(crbug.com/1002674): Remove once GtkIM-based LinuxInputMethodContext
// implementation is moved out of libgtkui.
// implementation is moved out of gtk.
#if defined(USE_X11)
display = gdk_x11_lookup_xdisplay(gfx::GetXDisplay());
#endif
Expand Down Expand Up @@ -647,4 +647,4 @@ GdkEvent* GdkEventFromKeyEvent(const ui::KeyEvent& key_event) {
return gdk_event;
}

} // namespace libgtkui
} // namespace gtk
Loading

0 comments on commit 5630ac2

Please sign in to comment.