@@ -3059,10 +3059,21 @@ static void luaWindowPositionHelper (lua_State *L, const RECT & r)
3059
3059
// ----------------------------------------
3060
3060
static int L_GetMainWindowPosition (lua_State *L)
3061
3061
{
3062
- CWindowPlacement wp;
3063
- Frame.GetWindowPlacement (&wp);
3062
+ bool useGetWindowRect = optboolean (L, 1 , 0 ); // if true use GetWindowRect
3063
+
3064
+ if (useGetWindowRect)
3065
+ {
3066
+ CRect rect;
3067
+ Frame.GetWindowRect (&rect);
3068
+ luaWindowPositionHelper (L, rect);
3069
+ }
3070
+ else
3071
+ {
3072
+ CWindowPlacement wp;
3073
+ Frame.GetWindowPlacement (&wp);
3074
+ luaWindowPositionHelper (L, wp.rcNormalPosition );
3075
+ }
3064
3076
3065
- luaWindowPositionHelper (L, wp.rcNormalPosition );
3066
3077
return 1 ; // number of result fields
3067
3078
} // end of L_GetMainWindowPosition
3068
3079
@@ -3109,9 +3120,9 @@ static int L_GetWorldWindowPosition (lua_State *L)
3109
3120
CMUSHclientDoc *pDoc = doc (L);
3110
3121
int which = my_optnumber (L, 1 , 1 ); // Which
3111
3122
bool screen = optboolean (L, 2 , 0 ); // client or screen
3123
+ bool useGetWindowRect = optboolean (L, 3 , 0 ); // if true use GetWindowRect
3112
3124
int count = 0 ;
3113
3125
3114
- CWindowPlacement wp;
3115
3126
3116
3127
for (POSITION pos=pDoc->GetFirstViewPosition ();pos!=NULL ;)
3117
3128
{
@@ -3126,13 +3137,22 @@ static int L_GetWorldWindowPosition (lua_State *L)
3126
3137
continue ; // wrong one
3127
3138
3128
3139
// pmyView->GetParentFrame ()->GetClientRect (&wp.rcNormalPosition);
3129
- pmyView->GetParentFrame ()->GetWindowPlacement (&wp);
3130
3140
3131
- if (screen)
3141
+ CRect rect;
3142
+ if (useGetWindowRect)
3132
3143
{
3133
- pmyView->GetParentFrame ()->ClientToScreen (&wp. rcNormalPosition );
3144
+ pmyView->GetParentFrame ()->GetWindowRect (&rect );
3134
3145
}
3135
- luaWindowPositionHelper (L, wp.rcNormalPosition );
3146
+ else
3147
+ {
3148
+ CWindowPlacement wp;
3149
+ pmyView->GetParentFrame ()->GetWindowPlacement (&wp);
3150
+ rect = wp.rcNormalPosition ;
3151
+ }
3152
+
3153
+ if (screen)
3154
+ pmyView->GetParentFrame ()->ClientToScreen (&rect);
3155
+ luaWindowPositionHelper (L, rect);
3136
3156
return 1 ; // number of result fields
3137
3157
3138
3158
}
0 commit comments