mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
x11: fix a typo after PR/13855 and kill lots of trailing whitespace
This commit is contained in:
@@ -56,7 +56,7 @@ typedef struct SDL_MessageBoxControlsX11
|
||||
static void X11_MessageBoxButtonCallback(SDL_ToolkitControlX11 *control, void *data)
|
||||
{
|
||||
SDL_MessageBoxCallbackDataX11 *cbdata;
|
||||
|
||||
|
||||
cbdata = (SDL_MessageBoxCallbackDataX11 *)data;
|
||||
*cbdata->buttonID = X11Toolkit_GetButtonControlData(control)->buttonID;
|
||||
X11Toolkit_SignalWindowClose(cbdata->window);
|
||||
@@ -71,25 +71,25 @@ static void X11_PositionMessageBox(SDL_MessageBoxControlsX11 *controls, int *wp,
|
||||
int h;
|
||||
int i;
|
||||
int t;
|
||||
|
||||
|
||||
/* Init vars */
|
||||
max_button_w = 50;
|
||||
max_button_h = 0;
|
||||
w = h = 2;
|
||||
i = t = total_button_w = total_text_and_icon_w = 0;
|
||||
max_button_w *= controls->window->iscale;
|
||||
|
||||
|
||||
/* Positioning and sizing */
|
||||
for (i = 0; i < controls->messageboxdata->numbuttons; i++) {
|
||||
max_button_w = SDL_max(max_button_w, controls->buttons[i]->rect.w);
|
||||
max_button_h = SDL_max(max_button_h, controls->buttons[i]->rect.h);
|
||||
controls->buttons[i]->rect.x = 0;
|
||||
}
|
||||
|
||||
|
||||
if (controls->icon) {
|
||||
controls->icon->rect.x = controls->icon->rect.y = 0;
|
||||
}
|
||||
|
||||
|
||||
if (controls->icon) {
|
||||
controls->message->rect.x = (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale) + controls->icon->rect.x + controls->icon->rect.w;
|
||||
controls->message->rect.y = X11Toolkit_GetIconControlCharY(controls->icon);
|
||||
@@ -100,40 +100,40 @@ static void X11_PositionMessageBox(SDL_MessageBoxControlsX11 *controls, int *wp,
|
||||
controls->icon->rect.w = 0;
|
||||
controls->icon->rect.h = 0;
|
||||
controls->icon->rect.x = 0;
|
||||
controls->icon->rect.y = 0;
|
||||
controls->icon->rect.y = 0;
|
||||
}
|
||||
if (controls->messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
|
||||
for (i = controls->messageboxdata->numbuttons; i != -1; i--) {
|
||||
controls->buttons[i]->rect.w = max_button_w;
|
||||
controls->buttons[i]->rect.h = max_button_h;
|
||||
X11Toolkit_NotifyControlOfSizeChange(controls->buttons[i]);
|
||||
|
||||
X11Toolkit_NotifyControlOfSizeChange(controls->buttons[i]);
|
||||
|
||||
if (controls->icon->rect.h > controls->message->rect.h) {
|
||||
controls->buttons[i]->rect.y = controls->icon->rect.h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 *controls-> window->iscale);
|
||||
} else {
|
||||
controls->buttons[i]->rect.y = controls->message->rect.h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
|
||||
}
|
||||
|
||||
controls->buttons[i]->rect.y = controls->message->rect.h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
|
||||
}
|
||||
|
||||
if (i) {
|
||||
controls->buttons[i]->rect.x = controls->buttons[i-1]->rect.x + controls->buttons[i-1]->rect.w + (SDL_TOOLKIT_X11_ELEMENT_PADDING_3 * controls->window->iscale);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < controls->messageboxdata->numbuttons; i++) {
|
||||
controls->buttons[i]->rect.w = max_button_w;
|
||||
controls->buttons[i]->rect.h = max_button_h;
|
||||
X11Toolkit_NotifyControlOfSizeChange(controls->buttons[i]);
|
||||
|
||||
X11Toolkit_NotifyControlOfSizeChange(controls->buttons[i]);
|
||||
|
||||
if (controls->icon->rect.h > controls->message->rect.h) {
|
||||
controls->buttons[i]->rect.y = controls->icon->rect.h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
|
||||
} else {
|
||||
controls->buttons[i]->rect.y = controls->message->rect.h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
|
||||
}
|
||||
|
||||
controls->buttons[i]->rect.y = controls->message->rect.h + (SDL_TOOLKIT_X11_ELEMENT_PADDING_2 * controls->window->iscale);
|
||||
}
|
||||
|
||||
if (i) {
|
||||
controls->buttons[i]->rect.x = controls->buttons[i-1]->rect.x + controls->buttons[i-1]->rect.w + (SDL_TOOLKIT_X11_ELEMENT_PADDING_3 * controls->window->iscale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
total_button_w = controls->buttons[controls->messageboxdata->numbuttons-1]->rect.x + controls->buttons[controls->messageboxdata->numbuttons-1]->rect.w;
|
||||
total_text_and_icon_w = controls->message->rect.x + controls->message->rect.w;
|
||||
@@ -161,8 +161,8 @@ static void X11_PositionMessageBox(SDL_MessageBoxControlsX11 *controls, int *wp,
|
||||
}
|
||||
if (!controls->messageboxdata->message) {
|
||||
controls->icon->rect.x = (w - controls->icon->rect.w)/2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
*wp = w;
|
||||
*hp = h;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ static void X11_OnMessageBoxScaleChange(SDL_ToolkitWindowX11 *window, void *data
|
||||
SDL_MessageBoxControlsX11 *controls;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
|
||||
controls = data;
|
||||
X11_PositionMessageBox(controls, &w, &h);
|
||||
X11Toolkit_ResizeWindow(window, w, h);
|
||||
@@ -185,16 +185,16 @@ static bool X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
|
||||
int i;
|
||||
int w;
|
||||
int h;
|
||||
|
||||
|
||||
controls.messageboxdata = messageboxdata;
|
||||
|
||||
|
||||
/* Color scheme */
|
||||
if (messageboxdata->colorScheme) {
|
||||
colorhints = messageboxdata->colorScheme->colors;
|
||||
} else {
|
||||
colorhints = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Create window */
|
||||
controls.window = X11Toolkit_CreateWindowStruct(messageboxdata->window, NULL, SDL_TOOLKIT_WINDOW_MODE_X11_DIALOG, colorhints);
|
||||
controls.window->cb_data = &controls;
|
||||
@@ -202,7 +202,7 @@ static bool X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
|
||||
if (!controls.window) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Create controls */
|
||||
controls.buttons = SDL_calloc(messageboxdata->numbuttons, sizeof(SDL_ToolkitControlX11 *));
|
||||
controls.icon = X11Toolkit_CreateIconControl(controls.window, messageboxdata->flags);
|
||||
@@ -216,7 +216,7 @@ static bool X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
|
||||
|
||||
/* Positioning */
|
||||
X11_PositionMessageBox(&controls, &w, &h);
|
||||
|
||||
|
||||
/* Actually create window, do event loop, cleanup */
|
||||
X11Toolkit_CreateWindowRes(controls.window, w, h, 0, 0, (char *)messageboxdata->title);
|
||||
X11Toolkit_DoWindowEventLoop(controls.window);
|
||||
|
@@ -41,7 +41,7 @@ static void X11_XsettingsNotify(const char *name, XSettingsAction action, XSetti
|
||||
SDL_VideoDevice *_this = data;
|
||||
|
||||
if (SDL_strcmp(name, SDL_XSETTINGS_GDK_WINDOW_SCALING_FACTOR) == 0 ||
|
||||
SDL_strcmp(name, SDL_XSETTINGS_GDK_UNSCALED_DPI) == 0 ||
|
||||
SDL_strcmp(name, SDL_XSETTINGS_GDK_UNSCALED_DPI) == 0 ||
|
||||
SDL_strcmp(name, SDL_XSETTINGS_XFT_DPI) == 0) {
|
||||
UpdateContentScale(_this);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -49,34 +49,34 @@ typedef enum SDL_ToolkitChildModeX11
|
||||
|
||||
typedef struct SDL_ToolkitWindowX11
|
||||
{
|
||||
/* Locale */
|
||||
/* Locale */
|
||||
char *origlocale;
|
||||
|
||||
/* Mode */
|
||||
|
||||
/* Mode */
|
||||
SDL_ToolkitWindowModeX11 mode;
|
||||
|
||||
|
||||
/* Display */
|
||||
Display *display;
|
||||
int screen;
|
||||
bool display_close;
|
||||
|
||||
|
||||
/* Parent */
|
||||
SDL_Window *parent;
|
||||
struct SDL_ToolkitWindowX11 *tk_parent;
|
||||
|
||||
/* Window */
|
||||
|
||||
/* Window */
|
||||
Window window;
|
||||
Drawable drawable;
|
||||
|
||||
|
||||
/* Visuals and drawing */
|
||||
Visual *visual;
|
||||
XVisualInfo vi;
|
||||
Colormap cmap;
|
||||
GC ctx;
|
||||
int depth;
|
||||
GC ctx;
|
||||
int depth;
|
||||
bool pixmap;
|
||||
|
||||
/* X11 extensions */
|
||||
/* X11 extensions */
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XDBE
|
||||
XdbeBackBuffer buf;
|
||||
bool xdbe; // Whether Xdbe is present or not
|
||||
@@ -86,37 +86,37 @@ typedef struct SDL_ToolkitWindowX11
|
||||
#endif
|
||||
bool utf8;
|
||||
|
||||
/* Atoms */
|
||||
/* Atoms */
|
||||
Atom wm_protocols;
|
||||
Atom wm_delete_message;
|
||||
|
||||
|
||||
/* Window and pixmap sizes */
|
||||
int window_width; // Window width.
|
||||
int window_height; // Window height.
|
||||
int pixmap_width;
|
||||
int pixmap_height;
|
||||
int window_x;
|
||||
int window_x;
|
||||
int window_y;
|
||||
|
||||
|
||||
/* XSettings and scaling */
|
||||
XSettingsClient *xsettings;
|
||||
bool xsettings_first_time;
|
||||
int iscale;
|
||||
float scale;
|
||||
|
||||
|
||||
/* Font */
|
||||
XFontSet font_set; // for UTF-8 systems
|
||||
XFontStruct *font_struct; // Latin1 (ASCII) fallback.
|
||||
|
||||
/* Control colors */
|
||||
const SDL_MessageBoxColor *color_hints;
|
||||
/* Control colors */
|
||||
const SDL_MessageBoxColor *color_hints;
|
||||
XColor xcolor[SDL_MESSAGEBOX_COLOR_COUNT];
|
||||
XColor xcolor_bevel_l1;
|
||||
XColor xcolor_bevel_l2;
|
||||
XColor xcolor_bevel_d;
|
||||
XColor xcolor_pressed;
|
||||
XColor xcolor_disabled_text;
|
||||
|
||||
XColor xcolor_disabled_text;
|
||||
|
||||
/* Control list */
|
||||
bool has_focus;
|
||||
struct SDL_ToolkitControlX11 *focused_control;
|
||||
@@ -126,12 +126,12 @@ typedef struct SDL_ToolkitWindowX11
|
||||
struct SDL_ToolkitControlX11 **dyn_controls;
|
||||
size_t dyn_controls_sz;
|
||||
|
||||
/* User callbacks */
|
||||
/* User callbacks */
|
||||
void *cb_data;
|
||||
void (*cb_on_scale_change)(struct SDL_ToolkitWindowX11 *, void *);
|
||||
|
||||
|
||||
/* Popup windows */
|
||||
SDL_ListNode *popup_windows;
|
||||
SDL_ListNode *popup_windows;
|
||||
|
||||
/* Event loop */
|
||||
XEvent *e;
|
||||
@@ -143,7 +143,7 @@ typedef struct SDL_ToolkitWindowX11
|
||||
float ev_scale;
|
||||
float ev_iscale;
|
||||
bool draw;
|
||||
bool close;
|
||||
bool close;
|
||||
long event_mask;
|
||||
} SDL_ToolkitWindowX11;
|
||||
|
||||
@@ -165,10 +165,10 @@ typedef struct SDL_ToolkitControlX11
|
||||
bool dynamic;
|
||||
bool is_default_enter;
|
||||
bool is_default_esc;
|
||||
|
||||
|
||||
/* User data */
|
||||
void *data;
|
||||
|
||||
|
||||
/* Virtual functions */
|
||||
void (*func_draw)(struct SDL_ToolkitControlX11 *);
|
||||
void (*func_calc_size)(struct SDL_ToolkitControlX11 *);
|
||||
@@ -183,10 +183,10 @@ typedef struct SDL_ToolkitMenuItemX11
|
||||
bool checkbox;
|
||||
bool checked;
|
||||
bool disabled;
|
||||
void *cb_data;
|
||||
void *cb_data;
|
||||
void (*cb)(struct SDL_ToolkitMenuItemX11 *, void *);
|
||||
SDL_ListNode *sub_menu;
|
||||
|
||||
|
||||
/* Internal use */
|
||||
SDL_Rect utf8_rect;
|
||||
SDL_Rect hover_rect;
|
||||
|
Reference in New Issue
Block a user