Przeglądaj źródła

chat panel cancel now closes the ime window if any

Asad M. Zaman 21 lat temu
rodzic
commit
d90a4405bb

+ 11 - 0
panda/src/display/graphicsWindow.cxx

@@ -299,6 +299,17 @@ move_pointer(int, int, int) {
   return false;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::close_ime
+//       Access: Published, Virtual
+//  Description: Forces the ime window to close if any
+//
+////////////////////////////////////////////////////////////////////
+void GraphicsWindow::
+close_ime() {
+  return;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsWindow::has_button_event
 //       Access: Public

+ 1 - 0
panda/src/display/graphicsWindow.h

@@ -65,6 +65,7 @@ PUBLISHED:
 
   MouseData get_pointer(int device) const;
   virtual bool move_pointer(int device, int x, int y);
+  virtual void close_ime();
 
 public:
   // No need to publish these.

+ 2 - 1
panda/src/pgui/pgEntry.cxx

@@ -471,7 +471,8 @@ candidate(const MouseWatcherParameter &param, bool background) {
       _candidate_highlight_end = param.get_highlight_end();
       _candidate_cursor_pos = param.get_cursor_pos();
       _text_geom_stale = true;
-      type(param);
+      if (!_candidate_wtext.empty())
+        type(param);
     }
   }
   PGItem::candidate(param, background);

+ 25 - 0
panda/src/windisplay/winGraphicsWindow.cxx

@@ -112,6 +112,31 @@ move_pointer(int device, int x, int y) {
   return true;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: WinGraphicsWindow::close_ime
+//       Access: Published, Virtual
+//  Description: Forces the ime window to close, if any
+//
+////////////////////////////////////////////////////////////////////
+void WinGraphicsWindow::
+close_ime() {
+  // Check if the ime window is open
+  if (!_ime_open)
+    return;
+
+  HIMC hIMC = ImmGetContext(_hWnd);
+  if (hIMC != 0) {
+    if (!ImmSetOpenStatus(hIMC, false)) {
+      windisplay_cat.debug() << "ImmSetOpenStatus failed\n";
+    }
+    ImmReleaseContext(_hWnd, hIMC);
+  }
+  _ime_open = false;
+  _ime_active = false;
+  windisplay_cat.debug() << "success: closed ime window\n";
+  return;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: WinGraphicsWindow::begin_flip
 //       Access: Public, Virtual

+ 2 - 0
panda/src/windisplay/winGraphicsWindow.h

@@ -47,6 +47,8 @@ public:
 
   virtual bool move_pointer(int device, int x, int y);
 
+  virtual void close_ime();
+
   virtual void begin_flip();
 
   virtual void process_events();