More newline and whitespace cleanups

This commit is contained in:
Jasmine Iwanek
2022-02-20 02:26:27 -05:00
parent a66e392b26
commit 4674756664
401 changed files with 6985 additions and 6985 deletions

View File

@@ -200,7 +200,7 @@ void HardwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) {
void HardwareRenderer::resizeEvent(QResizeEvent *event) {
onResize(width(), height());
QOpenGLWindow::resizeEvent(event);
}
@@ -214,7 +214,7 @@ bool HardwareRenderer::event(QEvent *event)
std::vector<std::tuple<uint8_t*, std::atomic_flag*>> HardwareRenderer::getBuffers()
{
std::vector<std::tuple<uint8_t*, std::atomic_flag*>> buffers;
buffers.push_back(std::make_tuple(imagebufs[0].get(), &buf_usage[0]));
buffers.push_back(std::make_tuple(imagebufs[1].get(), &buf_usage[1]));

View File

@@ -235,7 +235,7 @@ int main(int argc, char* argv[]) {
QObject::disconnect(main_window, &MainWindow::pollMouse, 0, 0);
QObject::connect(main_window, &MainWindow::pollMouse, (WindowsRawInputFilter*)rawInputFilter.get(), &WindowsRawInputFilter::mousePoll, Qt::DirectConnection);
main_window->setSendKeyboardInput(false);
}
}
#endif
pc_reset_hard_init();

View File

@@ -132,7 +132,7 @@ MainWindow::MainWindow(QWidget *parent) :
return;
}
if (!hide_tool_bar)
#ifdef _WIN32
#ifdef _WIN32
toolbar_label->setText(title);
#else
{
@@ -187,12 +187,12 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
if (!QApplication::platformName().contains("eglfs") && vid_resize == 0) {
w = qRound(w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
int modifiedHeight = qRound(h / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.))
+ menuBar()->height()
+ (statusBar()->height() * !hide_status_bar)
+ (ui->toolBar->height() * !hide_tool_bar);
ui->stackedWidget->resize(w, h);
setFixedSize(w, modifiedHeight);
}

View File

@@ -124,7 +124,7 @@ private:
Ui::MainWindow *ui;
std::unique_ptr<MachineStatus> status;
std::shared_ptr<MediaMenu> mm;
/* If main window should send keyboard input */
bool send_keyboard_input = true;
bool shownonce = false;

View File

@@ -130,7 +130,7 @@ NewFloppyDialog::NewFloppyDialog(MediaType type, QWidget *parent) :
util::DlgFilter({ "dsk","flp","im?","img","*fd?" }) %
tr("Surface images") %
util::DlgFilter({ "86f" }, true));
break;
case MediaType::Zip:
for (int i = 0; i < zipTypes.size(); ++i) {

View File

@@ -213,7 +213,7 @@ void RendererStack::switchRenderer(Renderer renderer) {
switch (renderer) {
case Renderer::Software:
{
auto sw = new SoftwareRenderer(this);
auto sw = new SoftwareRenderer(this);
rendererWindow = sw;
connect(this, &RendererStack::blitToRenderer, sw, &SoftwareRenderer::onBlit, Qt::QueuedConnection);
current.reset(this->createWindowContainer(sw, this));

View File

@@ -53,7 +53,7 @@ void SoftwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) {
cur_image = buf_idx;
buf_usage[(buf_idx + 1) % 2].clear();
source.setRect(x, y, w, h),
update();
}

View File

@@ -67,7 +67,7 @@ void SpecifyDimensions::on_SpecifyDimensions_accepted()
+ (!hide_status_bar ? main_window->statusBar()->height() : 0)
+ (!hide_tool_bar ? main_window->ui->toolBar->height() : 0)
+ main_window->menuBar()->height());
emit main_window->updateMenuResizeOptions();
main_window->show();
main_window->ui->stackedWidget->switchRenderer((RendererStack::Renderer)vid_api);

View File

@@ -7,10 +7,10 @@
* This file is part of the 86Box distribution.
*
* Windows VM-managers native messages filter
*
*
* Authors:
* Teemu Korhonen
*
*
* Copyright 2022 Teemu Korhonen
*/
@@ -63,4 +63,4 @@ bool WindowsManagerFilter::eventFilter(QObject *obj, QEvent *event)
}
return QObject::eventFilter(obj, event);
}
}

View File

@@ -7,10 +7,10 @@
* This file is part of the 86Box distribution.
*
* Header file for Windows VM-managers native messages filter
*
*
* Authors:
* Teemu Korhonen
*
*
* Copyright 2022 Teemu Korhonen
*/
@@ -24,7 +24,7 @@
#if QT_VERSION_MAJOR >= 6
#define result_t qintptr
#else
#else
#define result_t long
#endif

View File

@@ -7,14 +7,14 @@
* This file is part of the 86Box distribution.
*
* Windows raw input native filter for QT
*
*
* Authors:
* Teemu Korhonen
* Miran Grca, <mgrca8@gmail.com>
*
*
* Copyright 2021 Teemu Korhonen
* Copyright 2016-2018 Miran Grca.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -120,7 +120,7 @@ bool WindowsRawInputFilter::nativeEventFilter(const QByteArray &eventType, void
{
if (window->isActiveWindow() && menus_open == 0)
handle_input((HRAWINPUT)msg->lParam);
return true;
}
}
@@ -370,7 +370,7 @@ void WindowsRawInputFilter::mouse_handle(PRAWINPUT raw)
if (state.usFlags & MOUSE_MOVE_ABSOLUTE)
{
/* absolute mouse, i.e. RDP or VNC
/* absolute mouse, i.e. RDP or VNC
* seems to work fine for RDP on Windows 10
* Not sure about other environments.
*/

View File

@@ -7,12 +7,12 @@
* This file is part of the 86Box distribution.
*
* Header file for windows raw input native filter for QT
*
*
* Authors:
* Teemu Korhonen
*
*
* Copyright 2021 Teemu Korhonen
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -42,7 +42,7 @@
#if QT_VERSION_MAJOR >= 6
#define result_t qintptr
#else
#else
#define result_t long
#endif

View File

@@ -55,7 +55,7 @@ joystick_log(const char *fmt, ...)
typedef struct {
HANDLE hdevice;
PHIDP_PREPARSED_DATA data;
USAGE usage_button[256];
struct raw_axis_t {
@@ -127,7 +127,7 @@ void joystick_add_axis(raw_joystick_t* rawjoy, plat_joystick_t* joy, PHIDP_VALUE
} else {
/*
* Some joysticks will send -1 in LogicalMax, like Xbox Controllers
* so we need to mask that to appropriate value (instead of 0xFFFFFFFF)
* so we need to mask that to appropriate value (instead of 0xFFFFFFFF)
*/
rawjoy->axis[joy->nr_axes].max = prop->LogicalMax & ((1 << prop->BitSize) - 1);
}
@@ -158,7 +158,7 @@ void joystick_get_capabilities(raw_joystick_t* rawjoy, plat_joystick_t* joy) {
rawjoy->data = malloc(size);
if (GetRawInputDeviceInfoW(rawjoy->hdevice, RIDI_PREPARSEDDATA, rawjoy->data, &size) <= 0)
fatal("joystick_get_capabilities: Failed to get preparsed data.\n");
HIDP_CAPS caps;
HidP_GetCaps(rawjoy->data, &caps);
@@ -213,7 +213,7 @@ void joystick_get_device_name(raw_joystick_t* rawjoy, plat_joystick_t* joy, PRID
if (GetRawInputDeviceInfoA(rawjoy->hdevice, RIDI_DEVICENAME, device_name, &size) <= 0)
fatal("joystick_get_capabilities: Failed to get device name.\n");
HANDLE hDevObj = CreateFile(device_name, GENERIC_READ | GENERIC_WRITE,
HANDLE hDevObj = CreateFile(device_name, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hDevObj) {
HidD_GetProductString(hDevObj, device_desc_wide, sizeof(WCHAR) * 200);
@@ -223,8 +223,8 @@ void joystick_get_device_name(raw_joystick_t* rawjoy, plat_joystick_t* joy, PRID
int result = WideCharToMultiByte(CP_ACP, 0, device_desc_wide, 200, joy->name, 260, NULL, NULL);
if (result == 0 || strlen(joy->name) == 0)
sprintf(joy->name,
"RawInput %s, VID:%04lX PID:%04lX",
sprintf(joy->name,
"RawInput %s, VID:%04lX PID:%04lX",
info->hid.usUsage == HID_USAGE_GENERIC_JOYSTICK ? "Joystick" : "Gamepad",
info->hid.dwVendorId,
info->hid.dwProductId);
@@ -248,8 +248,8 @@ void joystick_init()
PRID_DEVICE_INFO info = NULL;
if (joysticks_present >= MAX_PLAT_JOYSTICKS) break;
if (deviceList[i].dwType != RIM_TYPEHID) continue;
if (deviceList[i].dwType != RIM_TYPEHID) continue;
/* Get device info: hardware IDs and usage IDs */
GetRawInputDeviceInfoA(deviceList[i].hDevice, RIDI_DEVICEINFO, NULL, &size);
info = malloc(size);
@@ -259,9 +259,9 @@ void joystick_init()
/* If this is not a joystick/gamepad, skip */
if (info->hid.usUsagePage != HID_USAGE_PAGE_GENERIC) goto end_loop;
if (info->hid.usUsage != HID_USAGE_GENERIC_JOYSTICK &&
if (info->hid.usUsage != HID_USAGE_GENERIC_JOYSTICK &&
info->hid.usUsage != HID_USAGE_GENERIC_GAMEPAD) goto end_loop;
plat_joystick_t *joy = &plat_joystick_state[joysticks_present];
raw_joystick_t *rawjoy = &raw_joystick_state[joysticks_present];
rawjoy->hdevice = deviceList[i].hDevice;
@@ -269,7 +269,7 @@ void joystick_init()
joystick_get_capabilities(rawjoy, joy);
joystick_get_device_name(rawjoy, joy, info);
joystick_log("joystick_init: %s - %d buttons, %d axes, %d POVs\n",
joystick_log("joystick_init: %s - %d buttons, %d axes, %d POVs\n",
joy->name, joy->nr_buttons, joy->nr_axes, joy->nr_povs);
joysticks_present++;
@@ -277,7 +277,7 @@ void joystick_init()
end_loop:
free(info);
}
joystick_log("joystick_init: joysticks_present=%i\n", joysticks_present);
/* Initialize the RawInput (joystick and gamepad) module. */
@@ -293,7 +293,7 @@ void joystick_init()
ridev[1].usUsage = HID_USAGE_GENERIC_GAMEPAD;
if (!RegisterRawInputDevices(ridev, 2, sizeof(RAWINPUTDEVICE)))
fatal("plat_joystick_init: RegisterRawInputDevices failed\n");
fatal("plat_joystick_init: RegisterRawInputDevices failed\n");
}
void joystick_close()
@@ -326,7 +326,7 @@ void win_joystick_handle(PRAWINPUT raw)
}
}
if (j == -1) return;
/* Read buttons */
USAGE usage_list[128] = {0};
ULONG usage_length = plat_joystick_state[j].nr_buttons;
@@ -334,7 +334,7 @@ void win_joystick_handle(PRAWINPUT raw)
r = HidP_GetUsages(HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usage_list, &usage_length,
raw_joystick_state[j].data, (PCHAR)raw->data.hid.bRawData, raw->data.hid.dwSizeHid);
if (r == HIDP_STATUS_SUCCESS) {
for (int i=0; i<usage_length; i++) {
int button = raw_joystick_state[j].usage_button[usage_list[i]];
@@ -349,9 +349,9 @@ void win_joystick_handle(PRAWINPUT raw)
LONG value = 0;
LONG center = (axis->max - axis->min + 1) / 2;
r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, axis->link, axis->usage, &uvalue,
r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, axis->link, axis->usage, &uvalue,
raw_joystick_state[j].data, (PCHAR)raw->data.hid.bRawData, raw->data.hid.dwSizeHid);
if (r == HIDP_STATUS_SUCCESS) {
if (axis->min < 0) {
/* extend signed uvalue to LONG */
@@ -371,7 +371,7 @@ void win_joystick_handle(PRAWINPUT raw)
}
plat_joystick_state[j].a[a] = value;
//joystick_log("%s %-06d ", plat_joystick_state[j].axis[a].name, plat_joystick_state[j].a[a]);
//joystick_log("%s %-06d ", plat_joystick_state[j].axis[a].name, plat_joystick_state[j].a[a]);
}
/* read povs */
@@ -379,10 +379,10 @@ void win_joystick_handle(PRAWINPUT raw)
struct raw_pov_t* pov = &raw_joystick_state[j].pov[p];
ULONG uvalue = 0;
LONG value = -1;
r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, pov->link, pov->usage, &uvalue,
r = HidP_GetUsageValue(HidP_Input, HID_USAGE_PAGE_GENERIC, pov->link, pov->usage, &uvalue,
raw_joystick_state[j].data, (PCHAR)raw->data.hid.bRawData, raw->data.hid.dwSizeHid);
if (r == HIDP_STATUS_SUCCESS && (uvalue >= pov->min && uvalue <= pov->max)) {
value = (uvalue - pov->min) * 36000;
value /= (pov->max - pov->min + 1);
@@ -392,7 +392,7 @@ void win_joystick_handle(PRAWINPUT raw)
plat_joystick_state[j].p[p] = value;
//joystick_log("%s %-3d ", plat_joystick_state[j].pov[p].name, plat_joystick_state[j].p[p]);
}
//joystick_log("\n");
}
@@ -405,13 +405,13 @@ static int joystick_get_axis(int joystick_nr, int mapping)
int pov = plat_joystick_state[joystick_nr].p[mapping & 3];
if (LOWORD(pov) == 0xFFFF)
return 0;
else
else
return sin((2*M_PI * (double)pov) / 36000.0) * 32767;
}
else if (mapping & POV_Y)
{
int pov = plat_joystick_state[joystick_nr].p[mapping & 3];
if (LOWORD(pov) == 0xFFFF)
return 0;
else
@@ -419,7 +419,7 @@ static int joystick_get_axis(int joystick_nr, int mapping)
}
else
return plat_joystick_state[joystick_nr].a[plat_joystick_state[joystick_nr].axis[mapping].id];
}
@@ -434,7 +434,7 @@ void joystick_process(void)
if (joystick_state[c].plat_joystick_nr)
{
int joystick_nr = joystick_state[c].plat_joystick_nr - 1;
for (d = 0; d < joystick_get_axis_count(joystick_type); d++)
joystick_state[c].axis[d] = joystick_get_axis(joystick_nr, joystick_state[c].axis_mapping[d]);
for (d = 0; d < joystick_get_button_count(joystick_type); d++)
@@ -447,10 +447,10 @@ void joystick_process(void)
x = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][0]);
y = joystick_get_axis(joystick_nr, joystick_state[c].pov_mapping[d][1]);
angle = (atan2((double)y, (double)x) * 360.0) / (2*M_PI);
magnitude = sqrt((double)x*(double)x + (double)y*(double)y);
if (magnitude < 16384)
joystick_state[c].pov[d] = -1;
else

View File

@@ -51,7 +51,7 @@ void wl_mouse_poll()
rel_mouse_y = 0;
}
static struct zwp_relative_pointer_v1_listener rel_listener =
static struct zwp_relative_pointer_v1_listener rel_listener =
{
rel_mouse_event
};