From: <tj...@us...> - 2011-08-14 04:15:07
|
Revision: 14964 http://alleg.svn.sourceforge.net/alleg/?rev=14964&view=rev Author: tjaden Date: 2011-08-14 04:15:01 +0000 (Sun, 14 Aug 2011) Log Message: ----------- Add a resize parameter to _al_win_create_icon and use it to make window titlebar icons the right size on Windows cherry-pick https://alleg.svn.sourceforge.net/svnroot/alleg/allegro/branches/5.1@14941 From: Trent Gamblin <tr...@ex...> Modified Paths: -------------- allegro/branches/5.0/include/allegro5/platform/aintwin.h allegro/branches/5.0/src/win/wmcursor.c allegro/branches/5.0/src/win/wwindow.c Modified: allegro/branches/5.0/include/allegro5/platform/aintwin.h =================================================================== --- allegro/branches/5.0/include/allegro5/platform/aintwin.h 2011-08-14 04:14:20 UTC (rev 14963) +++ allegro/branches/5.0/include/allegro5/platform/aintwin.h 2011-08-14 04:15:01 UTC (rev 14964) @@ -154,7 +154,7 @@ /* icon helpers */ void _al_win_set_display_icon(ALLEGRO_DISPLAY *display ,ALLEGRO_BITMAP *bitmap); -HICON _al_win_create_icon(HWND wnd, ALLEGRO_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor); +HICON _al_win_create_icon(HWND wnd, ALLEGRO_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor, bool resize); /* window decorations */ void _al_win_set_window_position(HWND window, int x, int y); Modified: allegro/branches/5.0/src/win/wmcursor.c =================================================================== --- allegro/branches/5.0/src/win/wmcursor.c 2011-08-14 04:14:20 UTC (rev 14963) +++ allegro/branches/5.0/src/win/wmcursor.c 2011-08-14 04:15:01 UTC (rev 14964) @@ -33,7 +33,7 @@ HICON _al_win_create_icon(HWND wnd, - ALLEGRO_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor) + ALLEGRO_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor, bool resize) { int x, y; int sys_sm_cx, sys_sm_cy; @@ -47,20 +47,26 @@ HBITMAP hOldXorMaskBitmap; HICON icon; - if (is_cursor) { - /* Get allowed cursor size - Windows can't make cursors of arbitrary size */ - sys_sm_cx = GetSystemMetrics(SM_CXCURSOR); - sys_sm_cy = GetSystemMetrics(SM_CYCURSOR); + if (resize) { + if (is_cursor) { + /* Get allowed cursor size - Windows can't make cursors of arbitrary size */ + sys_sm_cx = GetSystemMetrics(SM_CXCURSOR); + sys_sm_cy = GetSystemMetrics(SM_CYCURSOR); + } + else { + sys_sm_cx = GetSystemMetrics(SM_CXICON); + sys_sm_cy = GetSystemMetrics(SM_CYICON); + } + + if ((sprite->w > sys_sm_cx) || (sprite->h > sys_sm_cy)) { + return NULL; + } } else { - sys_sm_cx = GetSystemMetrics(SM_CXICON); - sys_sm_cy = GetSystemMetrics(SM_CYICON); + sys_sm_cx = al_get_bitmap_width(sprite); + sys_sm_cy = al_get_bitmap_height(sprite); } - if ((sprite->w > sys_sm_cx) || (sprite->h > sys_sm_cy)) { - return NULL; - } - /* Create bitmap */ h_dc = GetDC(wnd); h_xor_dc = CreateCompatibleDC(h_dc); @@ -132,7 +138,7 @@ /* A null HWND retrieves the DC for the entire screen. */ wnd = NULL; - hcursor = (HCURSOR)_al_win_create_icon(wnd, sprite, xfocus, yfocus, true); + hcursor = (HCURSOR)_al_win_create_icon(wnd, sprite, xfocus, yfocus, true, true); if (!hcursor) { return NULL; } Modified: allegro/branches/5.0/src/win/wwindow.c =================================================================== --- allegro/branches/5.0/src/win/wwindow.c 2011-08-14 04:14:20 UTC (rev 14963) +++ allegro/branches/5.0/src/win/wwindow.c 2011-08-14 04:15:01 UTC (rev 14964) @@ -821,7 +821,7 @@ al_restore_state(&backup); - icon = _al_win_create_icon(win_display->window, scaled_bmp, 0, 0, false); + icon = _al_win_create_icon(win_display->window, scaled_bmp, 0, 0, false, false); old_small = (HICON)SendMessage(win_display->window, WM_SETICON, ICON_SMALL, (LPARAM)icon); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |