Re: gdi32: Fix the GdiGetCodePage() support ANSI_CHARSET font associated charset

2013-02-25 Thread Byeongsik Jeon
Thank you.
Review again before submitting a patch to wine-patches, please.

On 02/26/13 00:08, Akihiro Sagawa wrote:
 On Sun, 24 Feb 2013 09:55:59 +0900, Byeongsik Jeon wrote:
 
 @@ -3615,6 +3675,10 @@ static void update_font_info(void)
  }
  if (!done)
  FIXME(there is no font defaults for codepages %u,%u\n, ansi_cp, 
 oem_cp);
 +
 +/* update locale dependent font association info in registry */
 +if (strcmp(buf, cpbuf))
 +update_font_association_info(ansi_cp);
  }
  
  static BOOL init_freetype(void)
 
 This condition should be rewritten. buf is not initialized when
 RegQueryValueExA is failed in line 3542. And strcmp(buf, cpbuf) has
 already done in line 3544.
 
I wanted to update in registry when codepages changed, not logpixels. When
logpixels has been changed, MS-Windows does not update the font associated
charset registry. memset(buf, 0, sizeof(buf)) has been added.

 diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
 index 943f584..9d57806 100644
 --- a/dlls/gdi32/tests/font.c
 +++ b/dlls/gdi32/tests/font.c
 
 Why are there no tests against OEM_CHARSET and SYMBOL_CHARSET?
 
In the current Wine code, if lfCharset == OEM_CHARSET then GetTextCharset()
return a wrong value. This problem can be found in the test_oemcharset(). At
this point, I wanted to concentrate on the ANSI_CHARSET association problem.
From 9be98fc85ee685f93ba61e208ceb7d9cd6662854 Mon Sep 17 00:00:00 2001
From: Byeongsik Jeon bsj...@hanmail.net
Date: Tue, 26 Feb 2013 10:31:20 +0900
Subject: [PATCH] gdi32: Fix the GdiGetCodePage() support ANSI_CHARSET font
 associated charset

---
 dlls/gdi32/font.c   | 64 +
 dlls/gdi32/freetype.c   | 50 +
 dlls/gdi32/tests/font.c | 85 +
 3 files changed, 199 insertions(+)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index b274b83..3a99d35 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -590,11 +590,75 @@ HFONT WINAPI CreateFontW( INT height, INT width, INT esc,
 return CreateFontIndirectW( logfont );
 }
 
+#define ASSOC_CHARSET_OEM(1)
+#define ASSOC_CHARSET_ANSI   (2)
+#define ASSOC_CHARSET_SYMBOL (4)
+static DWORD get_associated_charset_info(void)
+{
+static DWORD associated_charset = -1;
+
+if (associated_charset == -1)
+{
+static const WCHAR assoc_charset_reg_keyW[] = 
{'S','y','s','t','e','m','\\',
+
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+
'C','o','n','t','r','o','l','\\','F','o','n','t','A','s','s','o','c','\\',
+'A','s','s','o','c','i','a','t','e','d',' 
','C','h','a','r','s','e','t','\0'};
+static const WCHAR ansiW[] = {'A','N','S','I','(','0','0',')','\0'};
+static const WCHAR oemW[] = {'O','E','M','(','F','F',')','\0'};
+static const WCHAR symbolW[] = 
{'S','Y','M','B','O','L','(','0','2',')','\0'};
+static const WCHAR yesW[] = {'Y','E','S','\0'};
+HKEY hkey;
+WCHAR *dataW;
+DWORD type, data_len, max_data_len;
+
+associated_charset = 0;
+
+if (RegOpenKeyW(HKEY_LOCAL_MACHINE,
+assoc_charset_reg_keyW, hkey) != ERROR_SUCCESS)
+return 0;
+
+if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
NULL,
+ max_data_len, NULL, NULL) != ERROR_SUCCESS)
+return 0;
+
+dataW = HeapAlloc(GetProcessHeap(), 0, max_data_len);
+
+memset(dataW, 0, max_data_len);
+data_len = max_data_len;
+RegQueryValueExW(hkey, ansiW, NULL, type, (LPBYTE)dataW, data_len);
+if (type == REG_SZ  !strcmpiW(dataW, yesW))
+associated_charset |= ASSOC_CHARSET_ANSI;
+
+memset(dataW, 0, max_data_len);
+data_len = max_data_len;
+RegQueryValueExW(hkey, oemW, NULL, type, (LPBYTE)dataW, data_len);
+if (type == REG_SZ  !strcmpiW(dataW, yesW))
+associated_charset |= ASSOC_CHARSET_OEM;
+
+memset(dataW, 0, max_data_len);
+data_len = max_data_len;
+RegQueryValueExW(hkey, symbolW, NULL, type, (LPBYTE)dataW, data_len);
+if (type == REG_SZ  !strcmpiW(dataW, yesW))
+associated_charset |= ASSOC_CHARSET_SYMBOL;
+
+HeapFree(GetProcessHeap(), 0, dataW);
+RegCloseKey(hkey);
+
+TRACE(associated_charset = %d\n, associated_charset);
+}
+
+return associated_charset;
+}
+
 static void update_font_code_page( DC *dc )
 {
 CHARSETINFO csi;
 int charset = GetTextCharsetInfo( dc-hSelf, NULL, 0 );
 
+if (charset == ANSI_CHARSET 
+get_associated_charset_info()  ASSOC_CHARSET_ANSI)
+charset = DEFAULT_CHARSET;
+
 /* Hmm, nicely designed api this one! */
 if (TranslateCharsetInfo( ULongToPtr(charset), csi, TCI_SRCCHARSET) )
 dc-font_code_page = csi.ciACP;
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c

Re: gdi32: Revert an unrelated part of 028617b90ba586bdb30723c700eea888c159ada7.

2009-02-27 Thread Byeongsik Jeon
Yes!!! See the  http://bugs.winehq.org/show_bug.cgi?id=17218

http://www.winehq.org/pipermail/wine-patches/2009-February/068752.html

http://www.winehq.org/pipermail/wine-patches/2009-February/068753.html



2009-02-27 (Fri), 17:57 +0800, Dmitry Timoshkov wrote:
 It was not a very nice idea to break bitmap fonts which request a custom
 width (therefore a transformation) in a patch that pretended to do something
 unrelated.
 ---
  dlls/gdi32/freetype.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
 index 6ca35c3..54bb999 100644
 --- a/dlls/gdi32/freetype.c
 +++ b/dlls/gdi32/freetype.c
 @@ -4606,9 +4606,9 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, 
 UINT glyph, UINT format,
  }
  
  if(ft_face-glyph-format != ft_glyph_format_outline 
 -   (needsTransform || format == GGO_NATIVE || format == GGO_BEZIER ||
 -  format == GGO_GRAY2_BITMAP || format == 
 GGO_GRAY4_BITMAP ||
 -  format == GGO_GRAY8_BITMAP))
 +   (format == GGO_NATIVE || format == GGO_BEZIER ||
 +format == GGO_GRAY2_BITMAP || format == GGO_GRAY4_BITMAP ||
 +format == GGO_GRAY8_BITMAP))
  {
  TRACE(loaded a bitmap\n);
  LeaveCriticalSection( freetype_cs );





Re: gdi32: Revert an unrelated part of 028617b90ba586bdb30723c700eea888c159ada7.

2009-02-27 Thread Byeongsik Jeon
And, my patch [1/2] is wrong. Dmitry's patch is right.

Additionally, my patch [2/2] has to committed. Because of the other
problem. It's also my mistake.
http://bugs.winehq.org/show_bug.cgi?id=17218#c18


2009-02-27 (Fri), 21:50 +0900, Byeongsik Jeon wrote:
 Yes!!! See the  http://bugs.winehq.org/show_bug.cgi?id=17218
 
 http://www.winehq.org/pipermail/wine-patches/2009-February/068752.html
 
 http://www.winehq.org/pipermail/wine-patches/2009-February/068753.html
 
 
 
 2009-02-27 (Fri), 17:57 +0800, Dmitry Timoshkov wrote:
  It was not a very nice idea to break bitmap fonts which request a custom
  width (therefore a transformation) in a patch that pretended to do something
  unrelated.
  ---
   dlls/gdi32/freetype.c |6 +++---
   1 files changed, 3 insertions(+), 3 deletions(-)
  
  diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
  index 6ca35c3..54bb999 100644
  --- a/dlls/gdi32/freetype.c
  +++ b/dlls/gdi32/freetype.c
  @@ -4606,9 +4606,9 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, 
  UINT glyph, UINT format,
   }
   
   if(ft_face-glyph-format != ft_glyph_format_outline 
  -   (needsTransform || format == GGO_NATIVE || format == GGO_BEZIER ||
  -  format == GGO_GRAY2_BITMAP || format == 
  GGO_GRAY4_BITMAP ||
  -  format == GGO_GRAY8_BITMAP))
  +   (format == GGO_NATIVE || format == GGO_BEZIER ||
  +format == GGO_GRAY2_BITMAP || format == GGO_GRAY4_BITMAP ||
  +format == GGO_GRAY8_BITMAP))
   {
   TRACE(loaded a bitmap\n);
   LeaveCriticalSection( freetype_cs );
 
 
 
 





Re: gdi32: Implement QueryFontAssocStatus

2009-01-26 Thread Byeongsik Jeon
Again...
What's the problem?


2009-01-20 (Tue), 06:39 +0900, Byeongsik Jeon wrote:
 2009-01-19 (Mon), 09:40 +0900, Byeongsik Jeon wrote:
  QueryFontAssocStatus() is the undocumented function.
  This is a base patch for bug#16325.
  
  http://bugs.winehq.org/show_bug.cgi?id=16325
  
 Hmm...
 What is the problem of this patch?
 
 
  ---
   dlls/gdi32/font.c|   12 +++
   dlls/gdi32/freetype.c|   66 
  ++
   dlls/gdi32/gdi32.spec|2 +-
   dlls/gdi32/gdi_private.h |1 +
   dlls/gdi32/tests/Makefile.in |2 +-
   dlls/gdi32/tests/font.c  |   63 
  
   include/wingdi.h |1 +
   7 files changed, 145 insertions(+), 2 deletions(-)
  
 
 
 
 





Re: gdi32: Implement QueryFontAssocStatus

2009-01-19 Thread Byeongsik Jeon
2009-01-19 (Mon), 09:40 +0900, Byeongsik Jeon wrote:
 QueryFontAssocStatus() is the undocumented function.
 This is a base patch for bug#16325.
 
 http://bugs.winehq.org/show_bug.cgi?id=16325
 
Hmm...
What is the problem of this patch?


 ---
  dlls/gdi32/font.c|   12 +++
  dlls/gdi32/freetype.c|   66 
 ++
  dlls/gdi32/gdi32.spec|2 +-
  dlls/gdi32/gdi_private.h |1 +
  dlls/gdi32/tests/Makefile.in |2 +-
  dlls/gdi32/tests/font.c  |   63 
  include/wingdi.h |1 +
  7 files changed, 145 insertions(+), 2 deletions(-)
 





Re: user32: Send WM_IME_SETCONTEXT message when the window is focusedor unfocused.

2008-04-29 Thread ByeongSik Jeon
Dmitry Timoshkov wrote:
 ByeongSik Jeon [EMAIL PROTECTED] wrote:
 
  --- a/dlls/user32/tests/msg.c
  +++ b/dlls/user32/tests/msg.c
  @@ -10156,7 +10156,7 @@ static const struct message wm_lb_click_0[] =
   { HCBT_SETFOCUS, hook },
   { WM_KILLFOCUS, sent|parent },
   { WM_IME_SETCONTEXT, sent|wparam|optional|parent, 0 },
  -{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
  +{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
 
 Did you test this change under Windows? At the time I've added this test
 it passed cleanly under up to date XP SP2.
 
Yes, I did. I have tested with Windows XP SP3(+Korean MUI). This
platform is the IME enabled version. I attached log file.

$ grep 0x0281 user32_crosstest.msg.log
msg.c:10290: Test failed: WM_LBUTTONDOWN 0: the msg 0x0281 should NOT
have been sent by DefWindowProc

--
Add: The attached file removed. The file size is too big.

If WM_SETFOCUS come from defwinproc, WM_IME_SETCONTEXT come from defwinproc too.






Re: user32: Send WM_IME_SETCONTEXT message when the window is focusedor unfocused.

2008-04-29 Thread ByeongSik Jeon
Dmitry Timoshkov wrote:
 ByeongSik Jeon [EMAIL PROTECTED] wrote:
 
  --- a/dlls/user32/tests/msg.c
  +++ b/dlls/user32/tests/msg.c
  @@ -10156,7 +10156,7 @@ static const struct message wm_lb_click_0[] =
   { HCBT_SETFOCUS, hook },
   { WM_KILLFOCUS, sent|parent },
   { WM_IME_SETCONTEXT, sent|wparam|optional|parent, 0 },
  -{ WM_IME_SETCONTEXT, sent|wparam|optional, 1 },
  +{ WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 },
 
 Did you test this change under Windows? At the time I've added this test
 it passed cleanly under up to date XP SP2.
 
Yes, I did. I have tested with Windows XP SP3(+Korean MUI). This
platform is the IME enabled version. I attached log file.

$ grep 0x0281 user32_crosstest.msg.log
msg.c:10290: Test failed: WM_LBUTTONDOWN 0: the msg 0x0281 should NOT
have been sent by DefWindowProc



user32_crosstest.msg.log.gz
Description: GNU Zip compressed data



Re: imm32: If ImmNotifyIME fails, ImmSetOpenStatus should also fail.

2008-04-24 Thread ByeongSik Jeon
Kusanagi Kouichi wrote:
  if (!fOpen != !data-IMC.fOpen)
  {
 +if (!ImmNotifyIME( hIMC, NI_CONTEXTUPDATED, 0, IMC_SETOPENSTATUS))
 +return FALSE;
  data-IMC.fOpen = fOpen;
 -ImmNotifyIME( hIMC, NI_CONTEXTUPDATED, 0, IMC_SETOPENSTATUS);
  ImmInternalSendIMENotify(data, IMN_SETSENTENCEMODE, 0);
Hi,

MS Windows's native imm32.dll return TRUE although NotifyIME return
FALSE. I have tested it with the DDK's Japanese FakeIME.





Re: IMM / IME work

2008-04-16 Thread ByeongSik Jeon
Aric Stewart wrote:
   I have tested with windows ATOK20 (a popular Japanese IME) and 
 successfully had text processing in a fully IME aware application.
Great

I have tested with MS IME 2002(imekr61.ime), MS IME
2003(imekr70.ime), and Saenaru(saenaru.ime) [1].
These all are works with next two patches.

Default conversion mode toggle key of Korean IME is Hangul( == XK_Hangul
== VK_Hangul). 

Regards...

Thanks.

[1] Saenaru, Korean Free IME, http://kldp.net/projects/saenaru/
http://kldp.net/frs/download.php/4353/Saenaru-1.0.1.exe

INSTALL  SETUP
$ wine Saenaru-1.0.1.exe
$ regedit wine_saenaru.reg

Conversion mode toggle key: Shift+Space(by wine_saenaru.reg) or
Hangul(default)

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\OpenHangulProject]

[HKEY_LOCAL_MACHINE\Software\OpenHangulProject\Saenaru]
@=C:\\WINDOWS\\IME\\Saenaru
LayoutFlag=dword:0001
OptionFlag=dword:0080
StatusPos=dword:

[HKEY_LOCAL_MACHINE\Software\OpenHangulProject\Saenaru\Dictionary]
@=nabi.dic
HanjaIndex=jinsuk.dic
Symbol=symwin.dic
Word=word.dic

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Keyboard Layouts\E0010412]
IME file=SAENARU.IME

[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
UseXIM=N



imm32: Implement the ImmSetConversionStatus.

2008-04-16 Thread ByeongSik Jeon
Tested with MS IME 2002(imekr61.ime), MS IME
2003(imekr70.ime), and Saenaru(saenaru.ime, Korean Free IME).

---
 dlls/imm32/imm.c |   29 -
 1 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index c03d6fd..6fb73d2 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -1761,16 +1761,27 @@ BOOL WINAPI ImmSetCompositionWindow(
 BOOL WINAPI ImmSetConversionStatus(
   HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
 {
-  static int shown = 0;
+BOOL bConversion = TRUE;
+BOOL bSentence = TRUE;
+InputContextData *data = (InputContextData*)hIMC;
 
-  if (!shown) {
-  FIXME((%p, %d, %d): stub\n,
-  hIMC, fdwConversion, fdwSentence
-  );
-  shown = 1;
-  }
-  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-  return FALSE;
+TRACE(%p %d %d\n, hIMC, fdwConversion, fdwSentence);
+
+if (!data)
+return FALSE;
+
+if ( fdwConversion != data-IMC.fdwConversion )
+{
+data-IMC.fdwConversion = fdwConversion;
+bConversion = ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, 0, IMC_SETCONVERSIONMODE);
+}
+if ( fdwSentence != data-IMC.fdwSentence )
+{
+data-IMC.fdwSentence = fdwSentence;
+bSentence = ImmNotifyIME(hIMC, NI_CONTEXTUPDATED, 0, IMC_SETSENTENCEMODE);
+}
+
+return ( bConversion  bSentence );
 }
 
 /***