mirror of
https://github.com/brunodev85/winlator.git
synced 2026-10-22 22:12:11 +03:00
Update input_controls
This commit is contained in:
1 parent
525672e2a5
commit
9be2280aca
7 files changed
+205
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
{"id":10,"name":"FlatOut 2","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["KEY_CTRL_L","KEY_RIGHT","KEY_SPACE","KEY_LEFT"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_C","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_UP","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_DOWN","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_PG_DOWN","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ENTER","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"id":11,"name":"Gravity Circuit","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["KEY_UP","KEY_RIGHT","KEY_DOWN","KEY_LEFT"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_X","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_C","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_Z","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_SPACE","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ENTER","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0}],"controllers":[{"id":"0be874ed87b654ec4e25cf18e66d5096eceb59f7","name":"Gamesir-X2_26 650","controllerBindings":[{"keyCode":19,"binding":"KEY_UP"},{"keyCode":22,"binding":"KEY_RIGHT"},{"keyCode":20,"binding":"KEY_DOWN"},{"keyCode":21,"binding":"KEY_LEFT"},{"keyCode":108,"binding":"KEY_ENTER"},{"keyCode":109,"binding":"KEY_ESC"},{"keyCode":97,"binding":"KEY_SHIFT_L"},{"keyCode":96,"binding":"KEY_Z"},{"keyCode":99,"binding":"KEY_X"},{"keyCode":100,"binding":"KEY_A"}]}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"id":14,"name":"RAGE","cursorSpeed":1,"elements":[{"type":"D_PAD","shape":"CIRCLE","bindings":["KEY_W","KEY_D","KEY_S","KEY_A"],"scale":1,"x":0.10784313827753067,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["MOUSE_LEFT_BUTTON","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_V","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_E","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_SPACE","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_SHIFT_L","NONE","NONE","NONE"],"scale":1,"x":0.8235294222831726,"y":0.08888889104127884,"toggleSwitch":true,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_Q","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["MOUSE_RIGHT_BUTTON","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_CTRL_L","NONE","NONE","NONE"],"scale":1,"x":0.1764705926179886,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_R","NONE","NONE","NONE"],"scale":0.85,"x":0.9309640526771545,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_TAB","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_F1","NONE","NONE","NONE"],"scale":0.75,"x":0.0882352963089943,"y":0.2666666805744171,"toggleSwitch":false,"text":"","iconId":9},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_F3","NONE","NONE","NONE"],"scale":0.75,"x":0.0882352963089943,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":11},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_F2","NONE","NONE","NONE"],"scale":0.75,"x":0.12745098769664764,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":10},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_F4","NONE","NONE","NONE"],"scale":0.75,"x":0.04901960864663124,"y":0.35555556416511536,"toggleSwitch":false,"text":"","iconId":8},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_C","NONE","NONE","NONE"],"scale":0.85,"x":0.9309640526771545,"y":0.2666666805744171,"toggleSwitch":false,"text":"","iconId":0}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"id":8,"name":"Ultima Underworld","cursorSpeed":1,"elements":[{"type":"BUTTON","shape":"CIRCLE","bindings":["MOUSE_RIGHT_BUTTON","NONE","NONE","NONE"],"scale":1,"x":0.7941176295280457,"y":0.7111111283302307,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_J","NONE","NONE","NONE"],"scale":1,"x":0.9313725233078003,"y":0.7111111283302307,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_P","NONE","NONE","NONE"],"scale":1,"x":0.8627451062202454,"y":0.7111111283302307,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ENTER","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_A","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":2},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_X","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":5},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_S","NONE","NONE","NONE"],"scale":1,"x":0.12745098769664764,"y":0.644444465637207,"toggleSwitch":false,"text":"","iconId":3},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_D","NONE","NONE","NONE"],"scale":1,"x":0.1764705926179886,"y":0.7555555701255798,"toggleSwitch":false,"text":"","iconId":4},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_F2","NONE","NONE","NONE"],"scale":0.85,"x":0.9411764740943909,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_F3","NONE","NONE","NONE"],"scale":0.85,"x":0.9411764740943909,"y":0.20000000298023224,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_F4","NONE","NONE","NONE"],"scale":0.85,"x":0.9411764740943909,"y":0.31111112236976624,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_F5","NONE","NONE","NONE"],"scale":0.85,"x":0.9411764740943909,"y":0.42222222685813904,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"SQUARE","bindings":["KEY_F6","NONE","NONE","NONE"],"scale":0.85,"x":0.9411764740943909,"y":0.5333333611488342,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_1","NONE","NONE","NONE"],"scale":1,"x":0.7941176295280457,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_2","NONE","NONE","NONE"],"scale":1,"x":0.8627451062202454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_3","NONE","NONE","NONE"],"scale":1,"x":0.9313725233078003,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0}]}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"id":12,"name":"Unepic","cursorSpeed":1,"elements":[{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_SPACE","NONE","NONE","NONE"],"scale":1,"x":0.8133170008659363,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_UP","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.6000000238418579,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_DOWN","NONE","NONE","NONE"],"scale":1,"x":0.8721405267715454,"y":0.8666666746139526,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_ENTER","NONE","NONE","NONE"],"scale":1,"x":0.9309640526771545,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_T","NONE","NONE","NONE"],"scale":1,"x":0.8235294222831726,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_C","NONE","NONE","NONE"],"scale":1,"x":0.9215686321258545,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_TAB","NONE","NONE","NONE"],"scale":0.85,"x":0.06862745434045792,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_M","NONE","NONE","NONE"],"scale":1,"x":0.0784313753247261,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"RECT","bindings":["KEY_Q","NONE","NONE","NONE"],"scale":1,"x":0.1764705926179886,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_R","NONE","NONE","NONE"],"scale":0.85,"x":0.9309640526771545,"y":0.4444444477558136,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_ESC","NONE","NONE","NONE"],"scale":0.85,"x":0.538807213306427,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"BUTTON","shape":"ROUND_RECT","bindings":["KEY_I","NONE","NONE","NONE"],"scale":0.85,"x":0.46078431606292725,"y":0.9111111164093018,"toggleSwitch":false,"text":"","iconId":0},{"type":"RANGE_BUTTON","shape":"CIRCLE","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.5,"y":0.08888889104127884,"toggleSwitch":false,"text":"","iconId":0,"range":"FROM_F1_TO_F12"},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_LEFT","NONE","NONE","NONE"],"scale":1,"x":0.06862745434045792,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":2},{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_RIGHT","NONE","NONE","NONE"],"scale":1,"x":0.1568627506494522,"y":0.7333333492279053,"toggleSwitch":false,"text":"","iconId":4}]}
|
||||||
@@ -9,7 +9,9 @@ Driver Parallel Lines.icp
|
|||||||
Fallout 3.icp
|
Fallout 3.icp
|
||||||
Final Fantasy 8.icp
|
Final Fantasy 8.icp
|
||||||
Final Fantasy Type-0.icp
|
Final Fantasy Type-0.icp
|
||||||
|
FlatOut 2.icp
|
||||||
Front Mission Evolved.icp
|
Front Mission Evolved.icp
|
||||||
|
Gravity Circuit.icp
|
||||||
GTA 5.icp
|
GTA 5.icp
|
||||||
Hitman 2.icp
|
Hitman 2.icp
|
||||||
IGI 2.icp
|
IGI 2.icp
|
||||||
@@ -20,6 +22,7 @@ Metro 2033.icp
|
|||||||
Oblivion.icp
|
Oblivion.icp
|
||||||
Prey.icp
|
Prey.icp
|
||||||
Quake 4.icp
|
Quake 4.icp
|
||||||
|
RAGE.icp
|
||||||
Rayman 3.icp
|
Rayman 3.icp
|
||||||
Second Sight.icp
|
Second Sight.icp
|
||||||
Shovel Knight.icp
|
Shovel Knight.icp
|
||||||
@@ -30,5 +33,7 @@ Stalker CS.icp
|
|||||||
Star Wars Jedi Knight 2.icp
|
Star Wars Jedi Knight 2.icp
|
||||||
SteamWorld Dig 2.icp
|
SteamWorld Dig 2.icp
|
||||||
The Saboteur.icp
|
The Saboteur.icp
|
||||||
|
Ultima Underworld.icp
|
||||||
|
Unepic.icp
|
||||||
Wolfenstein.icp
|
Wolfenstein.icp
|
||||||
Xanadu Next.icp
|
Xanadu Next.icp
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
/*
|
||||||
|
* Desktop window class.
|
||||||
|
*
|
||||||
|
* Copyright 1994 Alexandre Julliard
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "wingdi.h"
|
||||||
|
#include "winnls.h"
|
||||||
|
#include "controls.h"
|
||||||
|
|
||||||
|
static HBRUSH hbrushPattern;
|
||||||
|
static HBITMAP hbitmapWallPaper;
|
||||||
|
static SIZE bitmapSize;
|
||||||
|
static BOOL fTileWallPaper;
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DESKTOP_LoadBitmap
|
||||||
|
*/
|
||||||
|
static HBITMAP DESKTOP_LoadBitmap( const WCHAR *filename )
|
||||||
|
{
|
||||||
|
HBITMAP hbitmap;
|
||||||
|
|
||||||
|
if (!filename[0]) return 0;
|
||||||
|
hbitmap = LoadImageW( 0, filename, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE );
|
||||||
|
if (!hbitmap)
|
||||||
|
{
|
||||||
|
WCHAR buffer[MAX_PATH];
|
||||||
|
UINT len = GetWindowsDirectoryW( buffer, MAX_PATH - 2 );
|
||||||
|
if (buffer[len - 1] != '\\') buffer[len++] = '\\';
|
||||||
|
lstrcpynW( buffer + len, filename, MAX_PATH - len );
|
||||||
|
hbitmap = LoadImageW( 0, buffer, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE );
|
||||||
|
}
|
||||||
|
return hbitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* init_wallpaper
|
||||||
|
*/
|
||||||
|
static void init_wallpaper( const WCHAR *wallpaper )
|
||||||
|
{
|
||||||
|
HBITMAP hbitmap = DESKTOP_LoadBitmap( wallpaper );
|
||||||
|
|
||||||
|
if (hbitmapWallPaper) DeleteObject( hbitmapWallPaper );
|
||||||
|
hbitmapWallPaper = hbitmap;
|
||||||
|
if (hbitmap)
|
||||||
|
{
|
||||||
|
BITMAP bmp;
|
||||||
|
GetObjectA( hbitmap, sizeof(bmp), &bmp );
|
||||||
|
bitmapSize.cx = (bmp.bmWidth != 0) ? bmp.bmWidth : 1;
|
||||||
|
bitmapSize.cy = (bmp.bmHeight != 0) ? bmp.bmHeight : 1;
|
||||||
|
fTileWallPaper = GetProfileIntA( "desktop", "TileWallPaper", 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DesktopWndProc
|
||||||
|
*/
|
||||||
|
LRESULT WINAPI DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case WM_NCCREATE:
|
||||||
|
case WM_NCCALCSIZE:
|
||||||
|
case WM_PARENTNOTIFY:
|
||||||
|
case WM_DISPLAYCHANGE:
|
||||||
|
return NtUserMessageCall( hwnd, message, wParam, lParam, 0, NtUserDesktopWindowProc, FALSE );
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (message < WM_USER)
|
||||||
|
return DefWindowProcW( hwnd, message, wParam, lParam );
|
||||||
|
return NtUserMessageCall( hwnd, message, wParam, lParam, 0, NtUserDesktopWindowProc, FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* PaintDesktop (USER32.@)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
BOOL WINAPI PaintDesktop(HDC hdc)
|
||||||
|
{
|
||||||
|
HWND hwnd = GetDesktopWindow();
|
||||||
|
|
||||||
|
/* check for an owning thread; otherwise don't paint anything (non-desktop mode) */
|
||||||
|
if (GetWindowThreadProcessId( hwnd, NULL ))
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
GetClientRect( hwnd, &rect );
|
||||||
|
|
||||||
|
/* Paint desktop pattern (only if wall paper does not cover everything) */
|
||||||
|
|
||||||
|
if (!hbitmapWallPaper ||
|
||||||
|
(!fTileWallPaper && ((bitmapSize.cx < rect.right) || (bitmapSize.cy < rect.bottom))))
|
||||||
|
{
|
||||||
|
HBRUSH brush = hbrushPattern;
|
||||||
|
if (!brush) brush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND );
|
||||||
|
/* Set colors in case pattern is a monochrome bitmap */
|
||||||
|
SetBkColor( hdc, RGB(0,0,0) );
|
||||||
|
SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) );
|
||||||
|
FillRect( hdc, &rect, brush );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Paint wall paper */
|
||||||
|
|
||||||
|
if (hbitmapWallPaper)
|
||||||
|
{
|
||||||
|
INT x, y;
|
||||||
|
HDC hMemDC = CreateCompatibleDC( hdc );
|
||||||
|
|
||||||
|
SelectObject( hMemDC, hbitmapWallPaper );
|
||||||
|
|
||||||
|
if (fTileWallPaper)
|
||||||
|
{
|
||||||
|
for (y = 0; y < rect.bottom; y += bitmapSize.cy)
|
||||||
|
for (x = 0; x < rect.right; x += bitmapSize.cx)
|
||||||
|
BitBlt( hdc, x, y, bitmapSize.cx, bitmapSize.cy, hMemDC, 0, 0, SRCCOPY );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SIZE deskSize;
|
||||||
|
deskSize.cx = rect.right - rect.left;
|
||||||
|
deskSize.cy = rect.bottom - rect.top;
|
||||||
|
|
||||||
|
StretchBlt( hdc, 0, 0, deskSize.cx, deskSize.cy, hMemDC, 0, 0, bitmapSize.cx, bitmapSize.cy, SRCCOPY );
|
||||||
|
}
|
||||||
|
DeleteDC( hMemDC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SetDeskWallPaper (USER32.@)
|
||||||
|
*
|
||||||
|
* FIXME: is there a unicode version?
|
||||||
|
*/
|
||||||
|
BOOL WINAPI SetDeskWallPaper( LPCSTR filename )
|
||||||
|
{
|
||||||
|
return SystemParametersInfoA( SPI_SETDESKWALLPAPER, MAX_PATH, (void *)filename, SPIF_UPDATEINIFILE );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* update_wallpaper
|
||||||
|
*/
|
||||||
|
BOOL update_wallpaper( const WCHAR *wallpaper, const WCHAR *pattern )
|
||||||
|
{
|
||||||
|
int pat[8];
|
||||||
|
|
||||||
|
if (hbrushPattern) DeleteObject( hbrushPattern );
|
||||||
|
hbrushPattern = 0;
|
||||||
|
memset( pat, 0, sizeof(pat) );
|
||||||
|
if (pattern)
|
||||||
|
{
|
||||||
|
char buffer[64];
|
||||||
|
WideCharToMultiByte( CP_ACP, 0, pattern, -1, buffer, sizeof(buffer), NULL, NULL );
|
||||||
|
if (sscanf( buffer, " %d %d %d %d %d %d %d %d",
|
||||||
|
&pat[0], &pat[1], &pat[2], &pat[3],
|
||||||
|
&pat[4], &pat[5], &pat[6], &pat[7] ))
|
||||||
|
{
|
||||||
|
WORD ptrn[8];
|
||||||
|
HBITMAP hbitmap;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++) ptrn[i] = pat[i] & 0xffff;
|
||||||
|
hbitmap = CreateBitmap( 8, 8, 1, 1, ptrn );
|
||||||
|
hbrushPattern = CreatePatternBrush( hbitmap );
|
||||||
|
DeleteObject( hbitmap );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_wallpaper( wallpaper );
|
||||||
|
NtUserRedrawWindow( GetDesktopWindow(), 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_NOCHILDREN );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user