forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request libretro#5904 from bparker06/opacity
Add menu setting for window opacity
- Loading branch information
Showing
17 changed files
with
258 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* RetroArch - A frontend for libretro. | ||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen | ||
* Copyright (C) 2011-2017 - Daniel De Matteis | ||
* Copyright (C) 2016-2017 - Brad Parker | ||
* | ||
* RetroArch 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 Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* RetroArch 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 RetroArch. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stddef.h> | ||
#include "../video_display_server.h" | ||
|
||
static void* null_display_server_init(void) | ||
{ | ||
return NULL; | ||
} | ||
|
||
static void null_display_server_destroy(void) | ||
{ | ||
|
||
} | ||
|
||
static bool null_set_window_opacity(void *data, unsigned opacity) | ||
{ | ||
(void)data; | ||
(void)opacity; | ||
return true; | ||
} | ||
|
||
const video_display_server_t dispserv_null = { | ||
null_display_server_init, | ||
null_display_server_destroy, | ||
null_set_window_opacity, | ||
"null" | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* RetroArch - A frontend for libretro. | ||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen | ||
* Copyright (C) 2011-2017 - Daniel De Matteis | ||
* Copyright (C) 2016-2017 - Brad Parker | ||
* | ||
* RetroArch 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 Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* RetroArch 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 RetroArch. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <windows.h> | ||
#include "../video_display_server.h" | ||
#include "../common/win32_common.h" | ||
|
||
typedef struct | ||
{ | ||
unsigned opacity; | ||
} dispserv_win32_t; | ||
|
||
static void* win32_display_server_init(void) | ||
{ | ||
dispserv_win32_t *dispserv = (dispserv_win32_t*)calloc(1, sizeof(*dispserv)); | ||
|
||
return dispserv; | ||
} | ||
|
||
static void win32_display_server_destroy(void) | ||
{ | ||
|
||
} | ||
|
||
static bool win32_set_window_opacity(void *data, unsigned opacity) | ||
{ | ||
HWND hwnd = win32_get_window(); | ||
dispserv_win32_t *serv = (dispserv_win32_t*)data; | ||
|
||
serv->opacity = opacity; | ||
|
||
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0500 | ||
/* Set window transparency on Windows 2000 and above */ | ||
return SetLayeredWindowAttributes(hwnd, 0, opacity, LWA_ALPHA); | ||
#else | ||
return false; | ||
#endif | ||
} | ||
|
||
const video_display_server_t dispserv_win32 = { | ||
win32_display_server_init, | ||
win32_display_server_destroy, | ||
win32_set_window_opacity, | ||
"win32" | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* RetroArch - A frontend for libretro. | ||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen | ||
* Copyright (C) 2011-2017 - Daniel De Matteis | ||
* Copyright (C) 2016-2017 - Brad Parker | ||
* | ||
* RetroArch 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 Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* RetroArch 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 RetroArch. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include "video_display_server.h" | ||
#include "video_driver.h" | ||
#include "../verbosity.h" | ||
|
||
static const video_display_server_t *current_display_server = NULL; | ||
static void *current_display_server_data = NULL; | ||
|
||
void* video_display_server_init(void) | ||
{ | ||
enum rarch_display_type type = video_driver_display_type_get(); | ||
|
||
switch (type) | ||
{ | ||
#if defined(_WIN32) && !defined(_XBOX) | ||
case RARCH_DISPLAY_WIN32: | ||
current_display_server = &dispserv_win32; | ||
break; | ||
#endif | ||
default: | ||
current_display_server = &dispserv_null; | ||
break; | ||
} | ||
|
||
current_display_server_data = current_display_server->init(); | ||
|
||
RARCH_LOG("[Video]: Found display server: %s\n", current_display_server->ident); | ||
|
||
return current_display_server_data; | ||
} | ||
|
||
void video_display_server_destroy(void) | ||
{ | ||
|
||
} | ||
|
||
bool video_display_server_set_window_opacity(unsigned opacity) | ||
{ | ||
return current_display_server->set_window_opacity(current_display_server_data, opacity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* RetroArch - A frontend for libretro. | ||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen | ||
* Copyright (C) 2011-2017 - Daniel De Matteis | ||
* Copyright (C) 2016-2017 - Brad Parker | ||
* | ||
* RetroArch 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 Found- | ||
* ation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* RetroArch 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 RetroArch. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __VIDEO_DISPLAY_SERVER__H | ||
#define __VIDEO_DISPLAY_SERVER__H | ||
|
||
#include <retro_common_api.h> | ||
#include <boolean.h> | ||
|
||
RETRO_BEGIN_DECLS | ||
|
||
typedef struct video_display_server | ||
{ | ||
void *(*init)(void); | ||
void (*destroy)(void); | ||
bool (*set_window_opacity)(void *data, unsigned opacity); | ||
const char *ident; | ||
} video_display_server_t; | ||
|
||
void* video_display_server_init(void); | ||
void video_display_server_destroy(void); | ||
bool video_display_server_set_window_opacity(unsigned opacity); | ||
|
||
extern const video_display_server_t dispserv_win32; | ||
extern const video_display_server_t dispserv_null; | ||
|
||
RETRO_END_DECLS | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.