{ "id": "142356", "key": "TIMOB-18323", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-01-07T01:03:26.000+0000", "created": "2015-01-06T20:54:32.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-14T19:13:22.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12642", "name": "Windows", "description": "Windows authoring support" } ], "description": "Some UI-related modules like `Ti.Gesture`, `Ti.Accelerometer` and `Ti.Platform.DisplayCaps` needs reference to \"current display information\" (`Windows::Graphics::Display::DisplayInformation`) to initialize internal state, but currently initializing it at module constructor is causing crash.\r\n\r\nLet say we have `Gesture` module and want to get current view after module is initialized, to initialize event listener. We could do it at constructor like below...\r\n\r\n{code}\r\nc++\r\n Gesture::Gesture() {\r\n // we want display information to initialize orientation event\r\n const auto display = Windows::Graphics::Display::DisplayInformation::GetForCurrentView();\r\n display->OrientationChanged += ....\r\n }\r\n{code}\r\n\r\nUnfortunately, this ends up crash with following error. Note that WinRT complains about thread usage, but it is not quite right. Seems like problem here is that CoreWindow is not initialized at the moment.\r\n\r\n{code}\r\nWinRT information: Windows.Graphics.Display: \r\nGetForCurrentView must be called on a thread that is associated with a CoreWindow.\r\n{code}\r\n\r\nSo, what we actually need is \"callback\" which is called when window is ready. UI-related module should get notified after window is ready, so that it can setup UI-related stuff safely. It could be something like this:\r\n\r\n{code}\r\n// override\r\nvoid Gesture::OnTitaniumMainWindowReady() {\r\n // ok, now we can get current view safely\r\n const auto display = Windows::Graphics::Display::DisplayInformation::GetForCurrentView\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Windows: UI-related module should be notified when app window is ready", "creator": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "338089", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Fixed by PR #51", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-01-07T01:03:26.000+0000", "updated": "2015-01-07T01:03:26.000+0000" }, { "id": "412161", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-14T19:13:22.000+0000", "updated": "2017-03-14T19:13:22.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }