mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
Meow
This commit is contained in:
parent
9f439b38b8
commit
eb8d38599b
7 changed files with 11 additions and 1290 deletions
|
|
@ -54,7 +54,6 @@ set(MAIN_HEADERS
|
|||
src/gl-util.h
|
||||
src/util.h
|
||||
src/config.h
|
||||
src/settingsmenu.h
|
||||
src/keybindings.h
|
||||
src/tileatlas.h
|
||||
src/sharedstate.h
|
||||
|
|
@ -103,7 +102,6 @@ set(MAIN_SOURCE
|
|||
src/gl-debug.cpp
|
||||
src/etc.cpp
|
||||
src/config.cpp
|
||||
src/settingsmenu.cpp
|
||||
src/security.cpp
|
||||
src/keybindings.cpp
|
||||
src/tileatlas.cpp
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <ruby.h>
|
||||
//костыль ебаный сука
|
||||
#undef snprintf
|
||||
|
||||
#undef inline
|
||||
|
||||
#include "exception.h"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
#include "sunshine.h"
|
||||
#include "etc.h"
|
||||
#include "sharedstate.h"
|
||||
#include "binding-util.h"
|
||||
|
|
@ -25,7 +26,7 @@
|
|||
static bool setStyle = false;
|
||||
static bool setTile = false;
|
||||
static bool isCached = false;
|
||||
#else
|
||||
#elif unix_like
|
||||
#ifdef __APPLE__
|
||||
#include "mac-desktop.h"
|
||||
static bool isCached = false;
|
||||
|
|
@ -53,9 +54,6 @@
|
|||
static std::map<std::string, bool> defBlurs;
|
||||
// Fallback settings
|
||||
static std::string fallbackPath;
|
||||
//For Standalone Window managwrs desktops
|
||||
bool IsNitrogen = false;
|
||||
bool IsFeh = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -67,27 +65,7 @@
|
|||
|
||||
desktop = shState->oneshot().desktopEnv;
|
||||
if (desktop != "nope") {
|
||||
#ifdef DEBUG
|
||||
printf("[desktopEnvironmentInit] Running on standalone Window Manager?Trying identify configuration...\n");
|
||||
#endif
|
||||
// If Nitrogen wallpaper manager and feh is aviable we can just use nitrogen --restore command and feh --bg-scale:P
|
||||
if (FILE *file = fopen("/usr/bin/nitrogen", "r")){
|
||||
IsNitrogen = true;
|
||||
#ifdef DEBUG
|
||||
printf("[desktopEnvironmentInit] Nitrogen wallpaper manager detected!I will try to use it...\n");
|
||||
#endif
|
||||
fclose(file);
|
||||
}else{ fclose(file); }
|
||||
if (FILE *file = fopen("/usr/bin/feh", "r")) {
|
||||
IsFeh = true;
|
||||
#ifdef DEBUG
|
||||
printf("[desktopEnvironmentInit] Feh detected!I will try to use it...\n");
|
||||
#endif
|
||||
fclose(file);
|
||||
} else{ fclose(file); }
|
||||
if(!IsNitrogen && !IsFeh){
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin") {
|
||||
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin") {
|
||||
|
|
@ -380,11 +358,6 @@ end:
|
|||
Debug() << "[wallpaperSet] Wallpaper command:" << command.str();
|
||||
Debug() << "[wallpaperSet ] Result:" << result;
|
||||
#endif
|
||||
} else if (IsFeh == true) {
|
||||
//path
|
||||
printf("[wallpaperSet] Trying set wallpapers via feh\n");
|
||||
std::string cmd = std::string("feh --bg-scale '") + path + "'";
|
||||
std::system(cmd.c_str());
|
||||
} else {
|
||||
std::ifstream srcHint(gameDirStr + path);
|
||||
std::ofstream dstHint(fallbackPath);
|
||||
|
|
@ -511,8 +484,6 @@ RB_METHOD(wallpaperReset){
|
|||
Debug() << "[wallpaperReset] Reset wallpaper command:" << command.str();
|
||||
Debug() << "[wallpaperReset] Reset result:" << result;
|
||||
#endif
|
||||
} else if (IsNitrogen == true){
|
||||
system("nitrogen --restore");
|
||||
} else {
|
||||
if (remove(fallbackPath.c_str()) != 0) {
|
||||
#ifdef DEBUG
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "sharedstate.h"
|
||||
#include "graphics.h"
|
||||
#include "settingsmenu.h"
|
||||
#include "al-util.h"
|
||||
#include "debugwriter.h"
|
||||
|
||||
|
|
@ -174,25 +173,12 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
|
||||
SDL_GetWindowSize(win, &winW, &winH); // SDL_GL_GetDrawableSize(win, &winW, &winH);
|
||||
|
||||
SettingsMenu *sMenu = 0;
|
||||
|
||||
while (true){
|
||||
if (!SDL_WaitEvent(&event)){
|
||||
Debug() << "[EventThread::process] EventThread: Event error";
|
||||
break;
|
||||
}
|
||||
|
||||
if (sMenu && sMenu->onEvent(event, joysticks)){
|
||||
if (sMenu->destroyReq()){
|
||||
delete sMenu;
|
||||
sMenu = 0;
|
||||
|
||||
updateCursorState(cursorInWindow && windowFocused, gameScreen);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Preselect and discard unwanted events here */
|
||||
switch (event.type){
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN :
|
||||
|
|
@ -227,14 +213,14 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
case SDL_EVENT_WINDOW_MOUSE_ENTER :
|
||||
cursorInWindow = true;
|
||||
mouseState.inWindow = true;
|
||||
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen);
|
||||
updateCursorState(cursorInWindow && windowFocused, gameScreen);
|
||||
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_MOUSE_LEAVE :
|
||||
cursorInWindow = false;
|
||||
mouseState.inWindow = false;
|
||||
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen);
|
||||
updateCursorState(cursorInWindow && windowFocused, gameScreen);
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -249,13 +235,13 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
|
||||
case SDL_EVENT_WINDOW_FOCUS_GAINED :
|
||||
windowFocused = true;
|
||||
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen);
|
||||
updateCursorState(cursorInWindow && windowFocused, gameScreen);
|
||||
|
||||
break;
|
||||
|
||||
case SDL_EVENT_WINDOW_FOCUS_LOST :
|
||||
windowFocused = false;
|
||||
updateCursorState(cursorInWindow && windowFocused && !sMenu, gameScreen);
|
||||
updateCursorState(cursorInWindow && windowFocused, gameScreen);
|
||||
resetInputStates();
|
||||
|
||||
break;
|
||||
|
|
@ -285,15 +271,6 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
break;
|
||||
|
||||
case SDL_EVENT_KEY_DOWN :
|
||||
if (event.key.scancode == SDL_SCANCODE_F1){
|
||||
if (!sMenu){
|
||||
sMenu = new SettingsMenu(rtData);
|
||||
updateCursorState(false, gameScreen);
|
||||
}
|
||||
|
||||
sMenu->raise();
|
||||
}
|
||||
|
||||
if (event.key.scancode == SDL_SCANCODE_F2){
|
||||
if (!displayingFPS){
|
||||
fps.immInitFlag.set();
|
||||
|
|
@ -518,8 +495,6 @@ void EventThread::process(RGSSThreadData &rtData){
|
|||
SDL_CloseGamepad(gcit->second);
|
||||
for (jsit = joysticks.begin(); jsit != joysticks.end(); ++jsit)
|
||||
SDL_CloseJoystick(jsit->second);
|
||||
|
||||
delete sMenu;
|
||||
}
|
||||
|
||||
bool EventThread::eventFilter(void *data, SDL_Event *event){
|
||||
|
|
|
|||
1176
src/settingsmenu.cpp
1176
src/settingsmenu.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
** settingsmenu.h
|
||||
**
|
||||
** This file is part of mkxp.
|
||||
**
|
||||
** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com>
|
||||
**
|
||||
** mkxp 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 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** mkxp is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with mkxp. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SETTINGSMENU_H
|
||||
#define SETTINGSMENU_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <map>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
|
||||
struct SettingsMenuPrivate;
|
||||
struct RGSSThreadData;
|
||||
union SDL_Event;
|
||||
|
||||
class SettingsMenu{
|
||||
public:
|
||||
SettingsMenu(RGSSThreadData &rtData);
|
||||
~SettingsMenu();
|
||||
|
||||
/* Returns true if the event was consumed */
|
||||
bool onEvent(const SDL_Event &event,
|
||||
const std::map<int, SDL_Joystick*> &joysticks);
|
||||
void raise();
|
||||
bool destroyReq() const;
|
||||
|
||||
private:
|
||||
SettingsMenuPrivate *p;
|
||||
};
|
||||
|
||||
#endif // SETTINGSMENU_H
|
||||
|
|
@ -4,10 +4,13 @@
|
|||
//помойка ебаная
|
||||
inline boost::chrono::high_resolution_clock::time_point startTime;
|
||||
|
||||
#if defined(__linux__) || defined(BSD) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GNU__) || defined(__hurd__) || defined(__DragonFly__)
|
||||
#define unix_like
|
||||
#if defined(__linux__) || defined(BSD) || defined(__sun) || defined(__APPLE__) || \
|
||||
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
defined(__GNU__) || defined(__hurd__) || defined(__DragonFly__)
|
||||
#define unix_like 1
|
||||
#endif
|
||||
|
||||
|
||||
class Sunshine{
|
||||
public:
|
||||
Sunshine();
|
||||
|
|
|
|||
Loading…
Reference in a new issue