オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Annotation of /aquaskk/trunk/platform/mac/src/server/MacInputModeWindow.mm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 79 - (hide annotations) (download) (as text)
Sun Nov 23 13:06:01 2008 UTC (15 years, 6 months ago) by t-suwa
File MIME type: text/x-objcsrc
File size: 4104 byte(s)
 r673@milonga:  t_suwa | 2008-11-09 23:54:45 +0900
 - SKKWidget.h:ユーザーインタフェース用の基底クラスを追加
 
 r674@milonga:  t_suwa | 2008-11-09 23:57:25 +0900
 - SKKDynamicCompletor:ダイナミック補完用ユーザーインタフェースクラスの追加
 
 r675@milonga:  t_suwa | 2008-11-09 23:58:05 +0900
 - SKKInputSessionParameter:SKKDynamicCompletor に対応
 
 r676@milonga:  t_suwa | 2008-11-09 23:58:36 +0900
 - SKKFrontEnd:補完インタフェースの除去
 
 r677@milonga:  t_suwa | 2008-11-09 23:59:18 +0900
 - SKKAnnotator, SKKCandidateWindow:SKKWidget を継承するように変更
 
 r678@milonga:  t_suwa | 2008-11-09 23:59:59 +0900
 - SKKWindowSelector:SKKCandidateWindow の変更に対応
 
 r679@milonga:  t_suwa | 2008-11-10 00:01:16 +0900
 - SKKContextBuffer, SKKInputEngine:SKKDynamicCompletor に対応
 
 r680@milonga:  t_suwa | 2008-11-10 00:02:24 +0900
 - SKKRecursiveEditor:SKKWidget に対応
 
 r681@milonga:  t_suwa | 2008-11-10 00:04:59 +0900
 - MacDynamicCompletor:新規追加
 
 r682@milonga:  t_suwa | 2008-11-10 00:05:21 +0900
 - MacAnnotator, MacCandidateWindow:SKKWidget に対応
 
 r683@milonga:  t_suwa | 2008-11-10 00:05:44 +0900
 - MacFrontEnd:補完用インタフェースの除去
 
 r684@milonga:  t_suwa | 2008-11-10 00:06:12 +0900
 - MacInputSessionParameter:SKKDynamicCompletor に対応
 
 r685@milonga:  t_suwa | 2008-11-10 00:06:50 +0900
 - SKKInputController:不要なウィンドウ制御を除去
 
 r686@milonga:  t_suwa | 2008-11-10 00:08:03 +0900
 - プロジェクト設定を変更(SKKWidget, SKKDynamicCompletor)
 
 r687@milonga:  t_suwa | 2008-11-10 00:11:53 +0900
 - 壊れたテストを修正
 
 r688@milonga:  t_suwa | 2008-11-12 22:58:08 +0900
 - SKKStatePrimary-inl:英数モードで l が入力できない不具合を修正
 
 r689@milonga:  t_suwa | 2008-11-12 22:59:47 +0900
 - SKKInputModeListener:SKKWidget を継承するように変更
 
 r690@milonga:  t_suwa | 2008-11-12 23:00:19 +0900
 - SKKInputEngine:SKKInputModeSelector の変更に対応
 
 r691@milonga:  t_suwa | 2008-11-12 23:00:58 +0900
 - SKKRecursiveEditor:SKKInputModeSelector の変更に対応
 
 r692@milonga:  t_suwa | 2008-11-12 23:02:30 +0900
 - SKKInputModeSelector:SKKWidget を継承するように変更
 
 r693@milonga:  t_suwa | 2008-11-12 23:03:43 +0900
 - MacInputModeMenu, MacInputModeWindow:SKKInputModeListener の変更に対応
 
 r694@milonga:  t_suwa | 2008-11-12 23:04:58 +0900
 - keymap.conf:補完して変換に shift::hex::0x20 を割り当て
 
 r695@milonga:  t_suwa | 2008-11-15 01:11:38 +0900
 - SKKStateComposing-inl:補完後の変換をキャンセルしても状態が戻らない不具合を修正
 
 r696@milonga:  t_suwa | 2008-11-15 01:17:06 +0900
 - SKKInputMode:入力モードを初期化していなかった不具合を修正
 
 r697@milonga:  t_suwa | 2008-11-15 01:18:10 +0900
 - SKKInputMenu:統合入力モードを返すメソッドの追加
 
 r698@milonga:  t_suwa | 2008-11-15 01:19:26 +0900
 - MacInputModeWindow:無効時に表示しないように修正
 
 r699@milonga:  t_suwa | 2008-11-15 01:20:15 +0900
 - MacInputModeMenu:メニュー更新タイミングを SKKWidget に合わせて修正
 
 r700@milonga:  t_suwa | 2008-11-15 01:21:32 +0900
 - SKKInputController:統合モードで入力モードを統一できなかった不具合を修正
 
 r701@milonga:  t_suwa | 2008-11-23 20:53:55 +0900
 - 暗黙の確定は入力文字に限定するように修正
 
 r702@milonga:  t_suwa | 2008-11-23 21:06:42 +0900
 - SKKInputQueue:入力状態の通知インタフェースを変更
 - SKKInputEngine:SKKInputQueue の変更に対応
 
 r703@milonga:  t_suwa | 2008-11-23 21:36:18 +0900
 - SKKInputQueue_TEST:壊れたテストを修正
 
 r704@milonga:  t_suwa | 2008-11-23 21:59:02 +0900
 - SKKInputEngineOption:最短マッチ表示オプションを追加
 - SKKInputEngine:最短マッチ表示オプションに対応
 
 r705@milonga:  t_suwa | 2008-11-23 22:00:06 +0900
 - SKKConstVars:最短マッチ表示オプションを追加
 - MacInputEngineOption:最短マッチ表示オプションを実装
 
 r706@milonga:  t_suwa | 2008-11-23 22:00:38 +0900
 - UserDefaults.plist:最短マッチ表示オプションを追加
 
 r707@milonga:  t_suwa | 2008-11-23 22:00:59 +0900
 - Preferences.xib:最短マッチ表示オプションに対応
 

1 t-suwa 5 /* -*- ObjC -*-
2    
3     MacOS X implementation of the SKK input method.
4    
5     Copyright (C) 2008 Tomotaka SUWA <t.suwa@mac.com>
6    
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     any later version.
11    
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20    
21     */
22    
23     #include "MacInputModeWindow.h"
24     #include "SKKFrontEnd.h"
25 t-suwa 59 #include "SKKConstVars.h"
26 t-suwa 61 #include "InputModeWindow.h"
27 t-suwa 5 #include <iostream>
28 t-suwa 50 #include <vector>
29 t-suwa 5
30 t-suwa 50 // MacInputModeWindow::Activate() から呼ばれるユーティリティ群
31     namespace {
32     // 左下原点を左上原点に変換する
33     CGPoint FlipPoint(int x, int y) {
34     NSRect screen = [[NSScreen mainScreen] frame];
35    
36     return CGPointMake(x, NSHeight(screen) - y);
37     }
38    
39     int ActiveProcessID() {
40     NSDictionary* info = [[NSWorkspace sharedWorkspace] activeApplication];
41     NSNumber* pid = [info objectForKey:@"NSApplicationProcessIdentifier"];
42    
43     return [pid intValue];
44     }
45    
46     typedef std::vector<CGRect> CGRectContainer;
47    
48     // プロセス ID に関連したウィンドウ矩形群の取得
49     CGRectContainer CreateWindowBoundsListOf(int pid) {
50     CGRectContainer result;
51     NSArray* array = (NSArray*)CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly,
52     kCGNullWindowID);
53     NSEnumerator* enumerator = [array objectEnumerator];
54    
55     while(NSDictionary* window = [enumerator nextObject]) {
56     // 引数のプロセス ID でフィルタ
57     NSNumber* owner = [window objectForKey:(NSString*)kCGWindowOwnerPID];
58     if([owner intValue] != pid) continue;
59    
60     // デスクトップ全面を覆う Finder のウィンドウは除外
61     NSNumber* level = [window objectForKey:(NSString*)kCGWindowLayer];
62     if([level intValue] == kCGMinimumWindowLevel) continue;
63    
64     CGRect rect;
65     NSDictionary* bounds = [window objectForKey:(NSString*)kCGWindowBounds];
66     if(CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)bounds, &rect)) {
67     result.push_back(rect);
68     }
69     }
70    
71     [array release];
72    
73     return result;
74     }
75     }
76    
77     // ============================================================
78    
79 t-suwa 5 MacInputModeWindow::MacInputModeWindow(SKKFrontEnd* frontend)
80 t-suwa 79 : frontend_(frontend)
81 t-suwa 50 , mode_(HirakanaInputMode) {
82 t-suwa 61 window_ = [InputModeWindow sharedWindow];
83     [window_ changeMode:mode_];
84 t-suwa 5 }
85    
86     void MacInputModeWindow::SelectInputMode(SKKInputMode mode) {
87 t-suwa 79 mode_ = mode;
88     }
89 t-suwa 5
90 t-suwa 79 // ------------------------------------------------------------
91    
92     bool MacInputModeWindow::enabled() const {
93     NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
94    
95     [defaults synchronize];
96    
97     return [defaults boolForKey:SKKUserDefaultKeys::show_input_mode_icon] == YES;
98 t-suwa 5 }
99    
100 t-suwa 79 void MacInputModeWindow::SKKWidgetShow() {
101 t-suwa 59 if(!enabled()) return;
102    
103 t-suwa 5 std::pair<int, int> position = frontend_->WindowPosition();
104    
105 t-suwa 50 CGPoint cursor = FlipPoint(position.first, position.second);
106     CGRectContainer list = CreateWindowBoundsListOf(ActiveProcessID());
107    
108     // カーソル位置がウィンドウ矩形に含まれていなければ無視する
109     int count = std::count_if(list.begin(), list.end(),
110     std::bind2nd(std::ptr_fun(CGRectContainsPoint), cursor));
111     if(!count) return;
112    
113 t-suwa 61 [window_ changeMode:mode_];
114     [window_ show:NSMakePoint(position.first, position.second) level:frontend_->WindowLevel()];
115 t-suwa 5 }
116    
117 t-suwa 79 void MacInputModeWindow::SKKWidgetHide() {
118 t-suwa 61 [window_ hide];
119 t-suwa 5 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26