mirror of
https://github.com/ctm/executor.git
synced 2025-02-17 05:31:27 +00:00
qt frontend: macOS fixes and workarounds
This commit is contained in:
parent
e68d366ad9
commit
16326934bf
@ -8,6 +8,15 @@
|
|||||||
|
|
||||||
#include "host-os-config.h"
|
#include "host-os-config.h"
|
||||||
|
|
||||||
|
QVector<QRect> getScreenGeometries()
|
||||||
|
{
|
||||||
|
QVector<QRect> geometries;
|
||||||
|
for(QScreen *screen : QGuiApplication::screens())
|
||||||
|
geometries.push_back(screen->geometry());
|
||||||
|
|
||||||
|
return geometries;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef LINUX
|
#ifndef LINUX
|
||||||
|
|
||||||
/* Actually, this should be the Qt-on-anything-but-X11 case. */
|
/* Actually, this should be the Qt-on-anything-but-X11 case. */
|
||||||
@ -85,4 +94,4 @@ QVector<QRect> getAvailableScreenGeometries()
|
|||||||
}
|
}
|
||||||
return geometries;
|
return geometries;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
QVector<QRect> getAvailableScreenGeometries();
|
QVector<QRect> getScreenGeometries();
|
||||||
|
QVector<QRect> getAvailableScreenGeometries();
|
||||||
|
@ -392,9 +392,10 @@ bool Executor::vdriver_set_mode(int width, int height, int bpp, bool grayscale_p
|
|||||||
qapp = new QGuiApplication(fakeArgc, fakeArgv);
|
qapp = new QGuiApplication(fakeArgc, fakeArgv);
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
macosx_hide_menu_bar(0);
|
macosx_hide_menu_bar(0);
|
||||||
#endif
|
QVector<QRect> screenGeometries = getScreenGeometries();
|
||||||
|
#else
|
||||||
QVector<QRect> screenGeometries = getAvailableScreenGeometries();
|
QVector<QRect> screenGeometries = getAvailableScreenGeometries();
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("set_mode: %d %d %d\n", width, height, bpp);
|
printf("set_mode: %d %d %d\n", width, height, bpp);
|
||||||
if(vdriver_fbuf)
|
if(vdriver_fbuf)
|
||||||
@ -426,7 +427,11 @@ bool Executor::vdriver_set_mode(int width, int height, int bpp, bool grayscale_p
|
|||||||
|
|
||||||
window = new ExecutorWindow();
|
window = new ExecutorWindow();
|
||||||
window->setGeometry(geom);
|
window->setGeometry(geom);
|
||||||
|
#ifdef MACOSX
|
||||||
|
window->show();//Maximized();
|
||||||
|
#else
|
||||||
window->showMaximized();
|
window->showMaximized();
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void Executor::vdriver_set_colors(int first_color, int num_colors, const ColorSpec *colors)
|
void Executor::vdriver_set_colors(int first_color, int num_colors, const ColorSpec *colors)
|
||||||
@ -459,19 +464,26 @@ void Executor::vdriver_get_colors(int first_color, int num_colors, ColorSpec *co
|
|||||||
void Executor::vdriver_update_screen_rects(int num_rects, const vdriver_rect_t *r,
|
void Executor::vdriver_update_screen_rects(int num_rects, const vdriver_rect_t *r,
|
||||||
bool cursor_p)
|
bool cursor_p)
|
||||||
{
|
{
|
||||||
|
#ifdef MACOSX /* something went wrong on the mac; quick fix */
|
||||||
|
window->update();
|
||||||
|
#else
|
||||||
QRegion rgn;
|
QRegion rgn;
|
||||||
for(int i = 0; i < num_rects; i++)
|
for(int i = 0; i < num_rects; i++)
|
||||||
{
|
{
|
||||||
rgn += QRect(r[i].left, r[i].top, r[i].right-r[i].left, r[i].bottom-r[i].top);
|
rgn += QRect(r[i].left, r[i].top, r[i].right-r[i].left, r[i].bottom-r[i].top);
|
||||||
//vdriver_update_screen(r[i].top, r[i].left, r[i].bottom, r[i].right, cursor_p);
|
|
||||||
}
|
}
|
||||||
window->update(rgn);
|
window->update(rgn);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Executor::vdriver_update_screen(int top, int left, int bottom, int right,
|
void Executor::vdriver_update_screen(int top, int left, int bottom, int right,
|
||||||
bool cursor_p)
|
bool cursor_p)
|
||||||
{
|
{
|
||||||
|
#ifdef MACOSX /* something went wrong on the mac; quick fix */
|
||||||
|
window->update();
|
||||||
|
#else
|
||||||
window->update(QRect(left, top, right-left, bottom-top));
|
window->update(QRect(left, top, right-left, bottom-top));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Executor::vdriver_flush_display(void)
|
void Executor::vdriver_flush_display(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user