Add window icon
Add a bugdroid icon loaded from an XPM.
This commit is contained in:
parent
5eb91a4ca7
commit
52c89c7afb
4 changed files with 70 additions and 3 deletions
|
@ -7,13 +7,13 @@ This project displays screens of Android devices plugged on USB in live.
|
||||||
|
|
||||||
### Runtime requirements
|
### Runtime requirements
|
||||||
|
|
||||||
This projects requires _FFmpeg_, _LibSDL2_ and _LibSDL2-net_.
|
This projects requires _FFmpeg_, _LibSDL2_, _LibSDL2-image_ and _LibSDL2-net_.
|
||||||
|
|
||||||
#### Linux
|
#### Linux
|
||||||
|
|
||||||
Install the packages from your package manager. For example, on Debian:
|
Install the packages from your package manager. For example, on Debian:
|
||||||
|
|
||||||
sudo apt install ffmpeg libsdl2-2.0.0 libsdl2-net-2.0.0
|
sudo apt install ffmpeg libsdl2-2.0.0 libsdl2-image-2.0.0 libsdl2-net-2.0.0
|
||||||
|
|
||||||
|
|
||||||
#### Windows
|
#### Windows
|
||||||
|
@ -21,6 +21,7 @@ Install the packages from your package manager. For example, on Debian:
|
||||||
From [MSYS2]:
|
From [MSYS2]:
|
||||||
|
|
||||||
pacman -S mingw-w64-x86_64-SDL2
|
pacman -S mingw-w64-x86_64-SDL2
|
||||||
|
pacman -S mingw-w64-x86_64-SDL2_image
|
||||||
pacman -S mingw-w64-x86_64-SDL2_net
|
pacman -S mingw-w64-x86_64-SDL2_net
|
||||||
pacman -S mingw-w64-x86_64-ffmpeg
|
pacman -S mingw-w64-x86_64-ffmpeg
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ described below.
|
||||||
|
|
||||||
sudo apt install make gcc openjdk-8-jdk pkg-config meson zip \
|
sudo apt install make gcc openjdk-8-jdk pkg-config meson zip \
|
||||||
libavcodec-dev libavformat-dev libavutil-dev \
|
libavcodec-dev libavformat-dev libavutil-dev \
|
||||||
libsdl2-dev libsdl2-net-dev
|
libsdl2-dev libsdl2-image-dev libsdl2-net-dev
|
||||||
|
|
||||||
|
|
||||||
#### Windows
|
#### Windows
|
||||||
|
|
|
@ -26,6 +26,7 @@ dependencies = [
|
||||||
dependency('libavcodec'),
|
dependency('libavcodec'),
|
||||||
dependency('libavutil'),
|
dependency('libavutil'),
|
||||||
dependency('sdl2'),
|
dependency('sdl2'),
|
||||||
|
dependency('SDL2_image'),
|
||||||
dependency('SDL2_net'),
|
dependency('SDL2_net'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
53
app/src/icon.xpm
Normal file
53
app/src/icon.xpm
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/* XPM */
|
||||||
|
static char * icon_xpm[] = {
|
||||||
|
"48 48 2 1",
|
||||||
|
" c None",
|
||||||
|
". c #96C13E",
|
||||||
|
" .. .. ",
|
||||||
|
" ... ... ",
|
||||||
|
" ... ...... ... ",
|
||||||
|
" ................ ",
|
||||||
|
" .............. ",
|
||||||
|
" ................ ",
|
||||||
|
" .................. ",
|
||||||
|
" .................... ",
|
||||||
|
" ..... ........ ..... ",
|
||||||
|
" ..... ........ ..... ",
|
||||||
|
" ...................... ",
|
||||||
|
" ........................ ",
|
||||||
|
" ........................ ",
|
||||||
|
" ........................ ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" .... ........................ .... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" ...... ........................ ...... ",
|
||||||
|
" .... ........................ .... ",
|
||||||
|
" ........................ ",
|
||||||
|
" ...................... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" ...... ...... ",
|
||||||
|
" .... .... "};
|
|
@ -6,6 +6,7 @@
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
#include <SDL2/SDL_image.h>
|
||||||
#include <SDL2/SDL_net.h>
|
#include <SDL2/SDL_net.h>
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
@ -19,6 +20,8 @@
|
||||||
#include "netutil.h"
|
#include "netutil.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
|
#include "icon.xpm"
|
||||||
|
|
||||||
#define DEVICE_NAME_FIELD_LENGTH 64
|
#define DEVICE_NAME_FIELD_LENGTH 64
|
||||||
#define DISPLAY_MARGINS 96
|
#define DISPLAY_MARGINS 96
|
||||||
|
|
||||||
|
@ -647,6 +650,15 @@ SDL_bool scrcpy(const char *serial, Uint16 local_port, Uint16 max_size, Uint32 b
|
||||||
goto screen_finally_destroy_renderer;
|
goto screen_finally_destroy_renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_Surface *icon = IMG_ReadXPMFromArray(icon_xpm);
|
||||||
|
if (!icon) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_SYSTEM, "Could not load icon: %s", SDL_GetError());
|
||||||
|
ret = SDL_FALSE;
|
||||||
|
goto screen_finally_destroy_renderer;
|
||||||
|
}
|
||||||
|
SDL_SetWindowIcon(window, icon);
|
||||||
|
SDL_FreeSurface(icon);
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Initial texture: %" PRIu16 "x%" PRIu16, frame_size.width, frame_size.height);
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Initial texture: %" PRIu16 "x%" PRIu16, frame_size.width, frame_size.height);
|
||||||
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, frame_size.width, frame_size.height);
|
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, frame_size.width, frame_size.height);
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
|
|
Loading…
Reference in a new issue