mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-11 18:54:20 +02:00
Update to v094r25 release.
byuu says: Windows port should run mostly well now, although exiting fullscreen breaks the application in a really bizarre way. (clicking on the window makes it sink to background rather than come to the foreground o_O) I also need to add the doModalChange => audio.clear() thing for the accursed menu stuttering with DirectSound. I also finished porting all of the ruby drivers over to the newer API changes from nall. Since I can't compile the Linux or OS X drivers, I have no idea if there are any typos that will result in compilation errors. If so, please let me know where they're at and I'll try and fix them. If they're simple, please try and fix them on your end to test further if you can. I'm hopeful the udev crash will be gone now that nall::string checks for null char* values passed to its stringify function. Of course, it's a problem it's getting a null value in the first place, so it may not work at all. If you can compile on Linux (or by some miracle, OS X), please test each video/audio/input driver if you don't mind, to make sure there's no "compiles okay but still typos exist" bugs.
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace hiro {
|
||||
|
||||
vector<pWindow*> pWindow::modal;
|
||||
|
||||
static const unsigned FixedStyle = WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX | WS_BORDER;
|
||||
static const unsigned ResizableStyle = WS_SYSMENU | WS_CAPTION | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME;
|
||||
|
||||
@@ -12,9 +10,13 @@ auto pWindow::construct() -> void {
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&reference);
|
||||
setDroppable(state().droppable);
|
||||
setGeometry({128, 128, 256, 256});
|
||||
|
||||
windows.append(self().instance);
|
||||
}
|
||||
|
||||
auto pWindow::destruct() -> void {
|
||||
if(auto position = windows.find(self().instance)) windows.remove(*position);
|
||||
|
||||
if(hbrush) { DeleteObject(hbrush); hbrush = nullptr; }
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
@@ -28,7 +30,7 @@ auto pWindow::append(sMenuBar menuBar) -> void {
|
||||
auto pWindow::append(sStatusBar statusBar) -> void {
|
||||
}
|
||||
|
||||
auto pWindow::focused() const -> bool override {
|
||||
auto pWindow::focused() const -> bool {
|
||||
return (GetForegroundWindow() == hwnd);
|
||||
}
|
||||
|
||||
@@ -122,7 +124,7 @@ auto pWindow::setGeometry(Geometry geometry) -> void {
|
||||
|
||||
auto pWindow::setModal(bool modality) -> void {
|
||||
if(modality) {
|
||||
modal.appendOnce(this);
|
||||
_modalityUpdate();
|
||||
while(state().modal) {
|
||||
Application::processEvents();
|
||||
if(Application::state.onMain) {
|
||||
@@ -131,7 +133,7 @@ auto pWindow::setModal(bool modality) -> void {
|
||||
usleep(20 * 1000);
|
||||
}
|
||||
}
|
||||
if(auto position = modal.find(this)) modal.remove(position());
|
||||
_modalityUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,6 +227,39 @@ auto pWindow::_geometry() -> Geometry {
|
||||
return {x, y, width, height};
|
||||
}
|
||||
|
||||
auto pWindow::_modalityCount() -> unsigned {
|
||||
unsigned modalWindows = 0;
|
||||
for(auto& weak : windows) {
|
||||
if(auto object = weak.acquire()) {
|
||||
if(auto window = dynamic_cast<mWindow*>(object.data())) {
|
||||
if(window->modal()) modalWindows++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return modalWindows;
|
||||
}
|
||||
|
||||
auto pWindow::_modalityDisabled() -> bool {
|
||||
if(_modalityCount() == 0) return false;
|
||||
return !state().modal;
|
||||
}
|
||||
|
||||
auto pWindow::_modalityUpdate() -> void {
|
||||
unsigned modalWindows = _modalityCount();
|
||||
for(auto& weak : windows) {
|
||||
if(auto object = weak.acquire()) {
|
||||
if(auto window = dynamic_cast<mWindow*>(object.data())) {
|
||||
if(auto self = window->self()) {
|
||||
bool enabled = !modalWindows || window->modal();
|
||||
if(IsWindowEnabled(self->hwnd) != enabled) {
|
||||
EnableWindow(self->hwnd, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user