|
1 | 1 | #include "displayserver_linux.h" |
2 | | -#include "util/mallocHelper.h" |
3 | | -#include "common/time.h" |
4 | 2 |
|
5 | | -#ifdef FF_HAVE_XCB |
| 3 | +#ifdef FF_HAVE_XCB_RANDR |
| 4 | + |
6 | 5 | #include "common/library.h" |
| 6 | +#include "common/time.h" |
| 7 | +#include "util/edidHelper.h" |
| 8 | +#include "util/mallocHelper.h" |
| 9 | + |
7 | 10 | #include <stdlib.h> |
8 | 11 | #include <string.h> |
| 12 | +#include <xcb/randr.h> |
9 | 13 | #include <xcb/xcb.h> |
10 | 14 |
|
11 | 15 | typedef struct XcbPropertyData |
@@ -82,72 +86,6 @@ static void xcbDetectWMfromEWMH(XcbPropertyData* data, xcb_connection_t* connect |
82 | 86 | ffStrbufSetS(&result->wmProcessName, wmName); |
83 | 87 | } |
84 | 88 |
|
85 | | -const char* ffdsConnectXcb(FFDisplayServerResult* result) |
86 | | -{ |
87 | | - FF_LIBRARY_LOAD(xcb, "dlopen lbxcb failed", "libxcb" FF_LIBRARY_EXTENSION, 2) |
88 | | - FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcb, xcb_connect) |
89 | | - FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcb, xcb_get_setup) |
90 | | - FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcb, xcb_setup_roots_iterator) |
91 | | - FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcb, xcb_screen_next) |
92 | | - FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcb, xcb_disconnect) |
93 | | - |
94 | | - XcbPropertyData propertyData; |
95 | | - bool propertyDataInitialized = xcbInitPropertyData(xcb, &propertyData); |
96 | | - |
97 | | - xcb_connection_t* connection = ffxcb_connect(NULL, NULL); |
98 | | - if(connection == NULL) |
99 | | - return "xcb_connect failed"; |
100 | | - |
101 | | - xcb_screen_iterator_t iterator = ffxcb_setup_roots_iterator(ffxcb_get_setup(connection)); |
102 | | - |
103 | | - if(iterator.rem > 0 && propertyDataInitialized) |
104 | | - xcbDetectWMfromEWMH(&propertyData, connection, iterator.data->root, result); |
105 | | - |
106 | | - while(iterator.rem > 0) |
107 | | - { |
108 | | - xcb_screen_t* screen = iterator.data; |
109 | | - ffdsAppendDisplay(result, |
110 | | - (uint32_t) screen->width_in_pixels, |
111 | | - (uint32_t) screen->height_in_pixels, |
112 | | - 0, |
113 | | - (uint32_t) screen->width_in_pixels, |
114 | | - (uint32_t) screen->height_in_pixels, |
115 | | - 0, |
116 | | - NULL, |
117 | | - FF_DISPLAY_TYPE_UNKNOWN, |
118 | | - false, |
119 | | - 0, |
120 | | - (uint32_t) screen->width_in_millimeters, |
121 | | - (uint32_t) screen->height_in_millimeters, |
122 | | - "xcb" |
123 | | - ); |
124 | | - ffxcb_screen_next(&iterator); |
125 | | - } |
126 | | - |
127 | | - ffxcb_disconnect(connection); |
128 | | - |
129 | | - //If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland. |
130 | | - if(result->wmProtocolName.length == 0) |
131 | | - ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); |
132 | | - |
133 | | - return NULL; |
134 | | -} |
135 | | - |
136 | | -#else |
137 | | - |
138 | | -const char* ffdsConnectXcb(FFDisplayServerResult* result) |
139 | | -{ |
140 | | - //Do nothing. There are other implementations coming |
141 | | - FF_UNUSED(result) |
142 | | - return "Fastfetch was compiled without XCB support"; |
143 | | -} |
144 | | - |
145 | | -#endif |
146 | | - |
147 | | -#ifdef FF_HAVE_XCB_RANDR |
148 | | -#include "util/edidHelper.h" |
149 | | -#include <xcb/randr.h> |
150 | | - |
151 | 89 | typedef struct XcbRandrData |
152 | 90 | { |
153 | 91 | FF_LIBRARY_SYMBOL(xcb_randr_get_screen_resources_current) |
|
0 commit comments