mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 11:28:17 -04:00
fix icon stuff
This commit is contained in:
parent
bc412732bf
commit
329e11a09d
@ -16,8 +16,6 @@ ConfigureFn(config_wdxdisplay) {
|
|||||||
init_libwdxdisplay();
|
init_libwdxdisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
string IconFileName = config_wdxdisplay.GetString("win32-window-icon","");
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: init_libwdxdisplay
|
// Function: init_libwdxdisplay
|
||||||
// Description: Initializes the library. This must be called at
|
// Description: Initializes the library. This must be called at
|
||||||
@ -43,3 +41,9 @@ init_libwdxdisplay() {
|
|||||||
wdxGraphicsWindow::get_class_type(),
|
wdxGraphicsWindow::get_class_type(),
|
||||||
wdxGraphicsWindow::make_wdxGraphicsWindow);
|
wdxGraphicsWindow::make_wdxGraphicsWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cant use global var cleanly because global var static init executed after init_libwgl(), incorrectly reiniting var
|
||||||
|
Filename get_icon_filename() {
|
||||||
|
string iconname = config_wdxdisplay.GetString("win32-window-icon","");
|
||||||
|
return ExecutionEnvironment::expand_string(iconname);
|
||||||
|
}
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
#define __CONFIG_WDXDISPLAY_H__
|
#define __CONFIG_WDXDISPLAY_H__
|
||||||
|
|
||||||
#include <pandabase.h>
|
#include <pandabase.h>
|
||||||
|
#include <filename.h>
|
||||||
#include <notifyCategoryProxy.h>
|
#include <notifyCategoryProxy.h>
|
||||||
|
|
||||||
NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
|
NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
|
||||||
|
|
||||||
extern string IconFileName;
|
extern Filename get_icon_filename();
|
||||||
|
|
||||||
extern EXPCL_PANDADX void init_libwdxdisplay();
|
extern EXPCL_PANDADX void init_libwdxdisplay();
|
||||||
|
|
||||||
|
@ -1103,8 +1103,13 @@ void wdxGraphicsWindow::config(void) {
|
|||||||
wc.lpfnWndProc = (WNDPROC) static_window_proc;
|
wc.lpfnWndProc = (WNDPROC) static_window_proc;
|
||||||
wc.hInstance = hinstance;
|
wc.hInstance = hinstance;
|
||||||
|
|
||||||
if(!IconFileName.empty()) {
|
|
||||||
wc.hIcon = (HICON) LoadImage(NULL, IconFileName.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
|
string windows_icon_filename = get_icon_filename().to_os_specific();
|
||||||
|
|
||||||
|
if(!windows_icon_filename.empty()) {
|
||||||
|
// Note: LoadImage seems to cause win2k internal heap corruption (outputdbgstr warnings)
|
||||||
|
// if icon is more than 8bpp
|
||||||
|
wc.hIcon = (HICON) LoadImage(NULL, windows_icon_filename.c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
|
||||||
} else {
|
} else {
|
||||||
wc.hIcon = NULL; // use default app icon
|
wc.hIcon = NULL; // use default app icon
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user