Skip to content

Commit f189b16

Browse files
committed
Use phlib window contexts for better window performance
1 parent 087c066 commit f189b16

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

phlib/colorbox.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ LRESULT CALLBACK PhpColorBoxWndProc(
147147
{
148148
PPHP_COLORBOX_CONTEXT context;
149149

150-
context = (PPHP_COLORBOX_CONTEXT)GetWindowLongPtr(hwnd, 0);
150+
context = PhGetWindowContext(hwnd, MAXCHAR);
151151

152152
if (uMsg == WM_CREATE)
153153
{
154154
PhpCreateColorBoxContext(&context);
155-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)context);
155+
PhSetWindowContext(hwnd, MAXCHAR, context);
156156
}
157157

158158
if (!context)
@@ -167,7 +167,7 @@ LRESULT CALLBACK PhpColorBoxWndProc(
167167
break;
168168
case WM_DESTROY:
169169
{
170-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
170+
PhRemoveWindowContext(hwnd, MAXCHAR);
171171
PhpFreeColorBoxContext(context);
172172
}
173173
break;

phlib/graph.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,12 +985,12 @@ LRESULT CALLBACK PhpGraphWndProc(
985985
{
986986
PPHP_GRAPH_CONTEXT context;
987987

988-
context = (PPHP_GRAPH_CONTEXT)GetWindowLongPtr(hwnd, 0);
988+
context = PhGetWindowContext(hwnd, MAXCHAR);
989989

990990
if (uMsg == WM_CREATE)
991991
{
992992
PhpCreateGraphContext(&context);
993-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)context);
993+
PhSetWindowContext(hwnd, MAXCHAR, context);
994994
}
995995

996996
if (!context)
@@ -1034,7 +1034,7 @@ LRESULT CALLBACK PhpGraphWndProc(
10341034
break;
10351035
case WM_DESTROY:
10361036
{
1037-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
1037+
PhRemoveWindowContext(hwnd, MAXCHAR);
10381038

10391039
if (context->TooltipHandle)
10401040
DestroyWindow(context->TooltipHandle);

phlib/hexedit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ LRESULT CALLBACK PhpHexEditWndProc(
108108
{
109109
PPHP_HEXEDIT_CONTEXT context;
110110

111-
context = (PPHP_HEXEDIT_CONTEXT)GetWindowLongPtr(hwnd, 0);
111+
context = PhGetWindowContext(hwnd, MAXCHAR);
112112

113113
if (uMsg == WM_CREATE)
114114
{
115115
PhpCreateHexEditContext(&context);
116-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)context);
116+
PhSetWindowContext(hwnd, MAXCHAR, context);
117117
}
118118

119119
if (!context)
@@ -128,7 +128,7 @@ LRESULT CALLBACK PhpHexEditWndProc(
128128
break;
129129
case WM_DESTROY:
130130
{
131-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
131+
PhRemoveWindowContext(hwnd, MAXCHAR);
132132
PhpFreeHexEditContext(context);
133133
}
134134
break;

phlib/treenew.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ LRESULT CALLBACK PhTnpWndProc(
9292
{
9393
PPH_TREENEW_CONTEXT context;
9494

95-
context = (PPH_TREENEW_CONTEXT)GetWindowLongPtr(hwnd, 0);
95+
context = PhGetWindowContext(hwnd, MAXCHAR);
9696

9797
if (uMsg == WM_CREATE)
9898
{
9999
PhTnpCreateTreeNewContext(&context);
100-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)context);
100+
PhSetWindowContext(hwnd, MAXCHAR, context);
101101
}
102102

103103
if (!context)
@@ -123,7 +123,7 @@ LRESULT CALLBACK PhTnpWndProc(
123123
{
124124
context->Callback(hwnd, TreeNewDestroying, NULL, NULL, context->CallbackContext);
125125
PhTnpDestroyTreeNewContext(context);
126-
SetWindowLongPtr(hwnd, 0, (LONG_PTR)NULL);
126+
PhRemoveWindowContext(hwnd, MAXCHAR);
127127
}
128128
return 0;
129129
case WM_SIZE:

0 commit comments

Comments
 (0)