Remove dependency on //build/config/linux/gtk

I'm planning on removing //build/config/linux/gtk in Chrome, so this
CL removes the dep in WebRTC.

Bug: None
Change-Id: I8b644ae38402335ba98fc4bf9932d132b6c816b4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258261
Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36514}
This commit is contained in:
Tom Anderson
2022-04-06 15:22:33 -07:00
committed by WebRTC LUCI CQ
parent a14e6ed09a
commit 06e4fc548c
2 changed files with 15 additions and 29 deletions

View File

@ -15,6 +15,8 @@ if (is_android) {
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
} else if (is_ios) { } else if (is_ios) {
import("//build/config/ios/rules.gni") import("//build/config/ios/rules.gni")
} else if (is_linux || is_chromeos) {
import("//build/config/linux/pkg_config.gni")
} }
group("examples") { group("examples") {
@ -660,6 +662,18 @@ if (is_ios || (is_mac && target_cpu != "x86")) {
} }
if (is_linux || is_chromeos || is_win) { if (is_linux || is_chromeos || is_win) {
if (is_linux || is_chromeos) {
pkg_config("gtk_config") {
packages = [
# Gtk requires gmodule, but it does not list it as a dependency in some
# misconfigured systems.
"gmodule-2.0",
"gthread-2.0",
"gtk+-3.0",
]
}
}
rtc_executable("peerconnection_client") { rtc_executable("peerconnection_client") {
testonly = true testonly = true
sources = [ sources = [
@ -726,7 +740,7 @@ if (is_linux || is_chromeos || is_win) {
"Xext", "Xext",
"Xrender", "Xrender",
] ]
deps += [ "//build/config/linux/gtk" ] configs += [ ":gtk_config" ]
} }
deps += [ deps += [

View File

@ -264,20 +264,12 @@ void GtkMainWnd::SwitchToConnectUI() {
peer_list_ = NULL; peer_list_ = NULL;
} }
#if GTK_MAJOR_VERSION == 2
vbox_ = gtk_vbox_new(FALSE, 5);
#else
vbox_ = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); vbox_ = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
#endif
GtkWidget* valign = gtk_alignment_new(0, 1, 0, 0); GtkWidget* valign = gtk_alignment_new(0, 1, 0, 0);
gtk_container_add(GTK_CONTAINER(vbox_), valign); gtk_container_add(GTK_CONTAINER(vbox_), valign);
gtk_container_add(GTK_CONTAINER(window_), vbox_); gtk_container_add(GTK_CONTAINER(window_), vbox_);
#if GTK_MAJOR_VERSION == 2
GtkWidget* hbox = gtk_hbox_new(FALSE, 5);
#else
GtkWidget* hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); GtkWidget* hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
#endif
GtkWidget* label = gtk_label_new("Server"); GtkWidget* label = gtk_label_new("Server");
gtk_container_add(GTK_CONTAINER(hbox), label); gtk_container_add(GTK_CONTAINER(hbox), label);
@ -386,11 +378,7 @@ void GtkMainWnd::OnClicked(GtkWidget* widget) {
void GtkMainWnd::OnKeyPress(GtkWidget* widget, GdkEventKey* key) { void GtkMainWnd::OnKeyPress(GtkWidget* widget, GdkEventKey* key) {
if (key->type == GDK_KEY_PRESS) { if (key->type == GDK_KEY_PRESS) {
switch (key->keyval) { switch (key->keyval) {
#if GTK_MAJOR_VERSION == 2
case GDK_Escape:
#else
case GDK_KEY_Escape: case GDK_KEY_Escape:
#endif
if (draw_area_) { if (draw_area_) {
callback_->DisconnectFromCurrentPeer(); callback_->DisconnectFromCurrentPeer();
} else if (peer_list_) { } else if (peer_list_) {
@ -398,13 +386,8 @@ void GtkMainWnd::OnKeyPress(GtkWidget* widget, GdkEventKey* key) {
} }
break; break;
#if GTK_MAJOR_VERSION == 2
case GDK_KP_Enter:
case GDK_Return:
#else
case GDK_KEY_KP_Enter: case GDK_KEY_KP_Enter:
case GDK_KEY_Return: case GDK_KEY_Return:
#endif
if (vbox_) { if (vbox_) {
OnClicked(NULL); OnClicked(NULL);
} else if (peer_list_) { } else if (peer_list_) {
@ -490,21 +473,13 @@ void GtkMainWnd::OnRedraw() {
} }
} }
#if GTK_MAJOR_VERSION == 2
gdk_draw_rgb_32_image(draw_area_->window,
draw_area_->style->fg_gc[GTK_STATE_NORMAL], 0, 0,
width_ * 2, height_ * 2, GDK_RGB_DITHER_MAX,
draw_buffer_.get(), (width_ * 2) * 4);
#else
gtk_widget_queue_draw(draw_area_); gtk_widget_queue_draw(draw_area_);
#endif
} }
gdk_threads_leave(); gdk_threads_leave();
} }
void GtkMainWnd::Draw(GtkWidget* widget, cairo_t* cr) { void GtkMainWnd::Draw(GtkWidget* widget, cairo_t* cr) {
#if GTK_MAJOR_VERSION != 2
cairo_format_t format = CAIRO_FORMAT_ARGB32; cairo_format_t format = CAIRO_FORMAT_ARGB32;
cairo_surface_t* surface = cairo_image_surface_create_for_data( cairo_surface_t* surface = cairo_image_surface_create_for_data(
draw_buffer_.get(), format, width_ * 2, height_ * 2, draw_buffer_.get(), format, width_ * 2, height_ * 2,
@ -513,9 +488,6 @@ void GtkMainWnd::Draw(GtkWidget* widget, cairo_t* cr) {
cairo_rectangle(cr, 0, 0, width_ * 2, height_ * 2); cairo_rectangle(cr, 0, 0, width_ * 2, height_ * 2);
cairo_fill(cr); cairo_fill(cr);
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
#else
RTC_DCHECK_NOTREACHED();
#endif
} }
GtkMainWnd::VideoRenderer::VideoRenderer( GtkMainWnd::VideoRenderer::VideoRenderer(