Skip to content

Commit eb7f73f

Browse files
linesightclaude
andcommitted
Fix Linux cmake --build failures: update CEF 146 Linux headers and add GTK3
- cef_types_linux.h: Sync with real CEF 146 — adds size_t size to _cef_window_info_t, cef_runtime_style_t runtime_style field, the full _cef_accelerated_paint_info_t + plane struct for Linux DMA-BUF, and missing includes (cef_types_color.h, cef_types_osr.h, cef_types_runtime.h). The old vendored header was from CEF ~66. - cef_linux.h: Sync with real CEF 146 — CefWindowInfoTraits::init now sets s->size, set() copies runtime_style, SetAsWindowless sets CEF_RUNTIME_STYLE_ALLOY. CefWindowInfo uses idiomatic using-inheritance. - client_handler/CMakeLists.txt: Add gtk+-3.0 pkg-config includes on Linux so dialog_handler_gtk.h (<gtk/gtk.h>) can be found. - subprocess/CMakeLists.txt: Add gtk+-3.0 pkg-config includes for the cefpython_app library on Linux (cefpython_app.cpp includes <gtk/gtk.h> when BROWSER_PROCESS is defined). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 083c3b2 commit eb7f73f

4 files changed

Lines changed: 121 additions & 34 deletions

File tree

src/client_handler/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ foreach(_f IN LISTS _all_cpp)
2424
endif()
2525
endforeach()
2626

27+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
28+
find_package(PkgConfig REQUIRED)
29+
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
30+
endif()
31+
2732
add_library(client_handler STATIC ${_sources})
2833
add_dependencies(client_handler cefpython_headers)
2934

@@ -34,6 +39,10 @@ target_include_directories(client_handler PRIVATE
3439
${Python_INCLUDE_DIRS}
3540
)
3641

42+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
43+
target_include_directories(client_handler PRIVATE ${GTK3_INCLUDE_DIRS})
44+
endif()
45+
3746
if(WIN32)
3847
target_compile_options(client_handler PRIVATE /EHsc /wd4190)
3948
target_compile_definitions(client_handler PRIVATE

src/include/internal/cef_linux.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
//
77
// * Redistributions of source code must retain the above copyright
88
// notice, this list of conditions and the following disclaimer.
9-
// * Redistributions in binary form must reproduce the above
10-
// copyright notice, this list of conditions and the following disclaimer
11-
// in the documentation and/or other materials provided with the
12-
// distribution.
9+
// * Redistributions in binary form must reproduce the above copyright
10+
// notice, this list of conditions and the following disclaimer in the
11+
// documentation and/or other materials provided with the distribution.
1312
// * Neither the name of Google Inc. nor the name Chromium Embedded
1413
// Framework nor the names of its contributors may be used to endorse
1514
// or promote products derived from this software without specific prior
@@ -53,7 +52,7 @@ class CefMainArgs : public cef_main_args_t {
5352
struct CefWindowInfoTraits {
5453
typedef cef_window_info_t struct_type;
5554

56-
static inline void init(struct_type* s) {}
55+
static inline void init(struct_type* s) { s->size = sizeof(struct_type); }
5756

5857
static inline void clear(struct_type* s) {
5958
cef_string_clear(&s->window_name);
@@ -70,6 +69,7 @@ struct CefWindowInfoTraits {
7069
target->shared_texture_enabled = src->shared_texture_enabled;
7170
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
7271
target->window = src->window;
72+
target->runtime_style = src->runtime_style;
7373
}
7474
};
7575

@@ -78,14 +78,9 @@ struct CefWindowInfoTraits {
7878
///
7979
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
8080
public:
81-
typedef CefStructBase<CefWindowInfoTraits> parent;
82-
83-
CefWindowInfo() : parent() {}
84-
explicit CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
85-
explicit CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
86-
87-
CefWindowInfo& operator=(const CefWindowInfo&) = default;
88-
CefWindowInfo& operator=(CefWindowInfo&&) = default;
81+
using base_type = CefStructBase<CefWindowInfoTraits>;
82+
using base_type::CefStructBase;
83+
using base_type::operator=;
8984

9085
///
9186
/// Create the browser as a child window.
@@ -110,6 +105,7 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
110105
void SetAsWindowless(CefWindowHandle parent) {
111106
windowless_rendering_enabled = true;
112107
parent_window = parent;
108+
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
113109
}
114110
};
115111

src/include/internal/cef_types_linux.h

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
//
77
// * Redistributions of source code must retain the above copyright
88
// notice, this list of conditions and the following disclaimer.
9-
// * Redistributions in binary form must reproduce the above
10-
// copyright notice, this list of conditions and the following disclaimer
11-
// in the documentation and/or other materials provided with the
12-
// distribution.
9+
// * Redistributions in binary form must reproduce the above copyright
10+
// notice, this list of conditions and the following disclaimer in the
11+
// documentation and/or other materials provided with the distribution.
1312
// * Neither the name of Google Inc. nor the name Chromium Embedded
1413
// Framework nor the names of its contributors may be used to endorse
1514
// or promote products derived from this software without specific prior
@@ -31,30 +30,18 @@
3130
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
3231
#pragma once
3332

33+
#if !defined(GENERATING_CEF_API_HASH)
3434
#include "include/base/cef_build.h"
35-
#include "include/cef_config.h"
35+
#endif
3636

3737
#if defined(OS_LINUX)
3838

39-
#if defined(CEF_X11)
40-
typedef union _XEvent XEvent;
41-
typedef struct _XDisplay XDisplay;
42-
#endif
43-
4439
#include "include/internal/cef_export.h"
4540
#include "include/internal/cef_string.h"
41+
#include "include/internal/cef_types_color.h"
4642
#include "include/internal/cef_types_geometry.h"
47-
48-
// Handle types.
49-
#if defined(CEF_X11)
50-
#define cef_cursor_handle_t unsigned long
51-
#define cef_event_handle_t XEvent*
52-
#else
53-
#define cef_cursor_handle_t void*
54-
#define cef_event_handle_t void*
55-
#endif
56-
57-
#define cef_window_handle_t unsigned long
43+
#include "include/internal/cef_types_osr.h"
44+
#include "include/internal/cef_types_runtime.h"
5845

5946
#define kNullCursorHandle 0
6047
#define kNullEventHandle NULL
@@ -64,6 +51,20 @@ typedef struct _XDisplay XDisplay;
6451
extern "C" {
6552
#endif
6653

54+
#if defined(CEF_X11)
55+
typedef union _XEvent XEvent;
56+
typedef struct _XDisplay XDisplay;
57+
58+
// Handle types.
59+
typedef unsigned long cef_cursor_handle_t;
60+
typedef XEvent* cef_event_handle_t;
61+
#else
62+
typedef void* cef_cursor_handle_t;
63+
typedef void* cef_event_handle_t;
64+
#endif
65+
66+
typedef unsigned long cef_window_handle_t;
67+
6768
///
6869
/// Return the singleton X11 display shared with Chromium. The display is not
6970
/// thread-safe and must only be accessed on the browser process UI thread.
@@ -84,6 +85,11 @@ typedef struct _cef_main_args_t {
8485
/// Class representing window information.
8586
///
8687
typedef struct _cef_window_info_t {
88+
///
89+
/// Size of this structure.
90+
///
91+
size_t size;
92+
8793
///
8894
/// The initial title of the window, to be set when the window is created.
8995
/// Some layout managers (e.g., Compiz) can look at the window title
@@ -135,8 +141,75 @@ typedef struct _cef_window_info_t {
135141
/// Pointer for the new browser window. Only used with windowed rendering.
136142
///
137143
cef_window_handle_t window;
144+
145+
///
146+
/// Optionally change the runtime style. Alloy style will always be used if
147+
/// |windowless_rendering_enabled| is true. See cef_runtime_style_t
148+
/// documentation for details.
149+
///
150+
cef_runtime_style_t runtime_style;
138151
} cef_window_info_t;
139152

153+
///
154+
/// Structure containing the plane information of the shared texture.
155+
/// Sync with native_pixmap_handle.h
156+
///
157+
typedef struct _cef_accelerated_paint_native_pixmap_plane_info_t {
158+
///
159+
/// The strides and offsets in bytes to be used when accessing the buffers via
160+
/// a memory mapping. One per plane per entry. Size in bytes of the plane is
161+
/// necessary to map the buffers.
162+
///
163+
uint32_t stride;
164+
uint64_t offset;
165+
uint64_t size;
166+
167+
///
168+
/// File descriptor for the underlying memory object (usually dmabuf).
169+
///
170+
int fd;
171+
} cef_accelerated_paint_native_pixmap_plane_t;
172+
173+
#define kAcceleratedPaintMaxPlanes 4
174+
175+
///
176+
/// Structure containing shared texture information for the OnAcceleratedPaint
177+
/// callback. Resources will be released to the underlying pool for reuse when
178+
/// the callback returns from client code.
179+
///
180+
typedef struct _cef_accelerated_paint_info_t {
181+
///
182+
/// Size of this structure.
183+
///
184+
size_t size;
185+
186+
///
187+
/// Planes of the shared texture, usually file descriptors of dmabufs.
188+
///
189+
cef_accelerated_paint_native_pixmap_plane_t
190+
planes[kAcceleratedPaintMaxPlanes];
191+
192+
///
193+
/// Plane count.
194+
///
195+
int plane_count;
196+
197+
///
198+
/// Modifier could be used with EGL driver.
199+
///
200+
uint64_t modifier;
201+
202+
///
203+
/// The pixel format of the texture.
204+
///
205+
cef_color_type_t format;
206+
207+
///
208+
/// The extra common info.
209+
///
210+
cef_accelerated_paint_info_common_t extra;
211+
} cef_accelerated_paint_info_t;
212+
140213
#ifdef __cplusplus
141214
}
142215
#endif

src/subprocess/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ foreach(_f IN LISTS _filtered_all)
5050
endforeach()
5151
list(APPEND _app_sources ${_filtered_mml})
5252

53+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
54+
find_package(PkgConfig REQUIRED)
55+
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
56+
endif()
57+
5358
add_library(cefpython_app STATIC ${_app_sources})
5459
add_dependencies(cefpython_app cefpython_headers)
5560

@@ -60,6 +65,10 @@ target_include_directories(cefpython_app PRIVATE
6065
${Python_INCLUDE_DIRS}
6166
)
6267

68+
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
69+
target_include_directories(cefpython_app PRIVATE ${GTK3_INCLUDE_DIRS})
70+
endif()
71+
6372
if(WIN32)
6473
target_compile_options(cefpython_app PRIVATE /EHsc /wd4190)
6574
target_compile_definitions(cefpython_app PRIVATE

0 commit comments

Comments
 (0)