Wait until a requested event is finished in X11 - x11

I want to resize some window with
XResizeWindow(display, xid, width, height)
which was created by another application and waits until it is really resized.
I tried the following:
XSync(display, 0)
but it does not work.
Any suggestions?

XSync just ensures the request has been delivered to the Xserver, and doesn't wait for the other application and/or window manager to deal with the request.
Have you tried registering for ConfigureNotify events on that window?

Related

uiless action in Outlook add-in with displayDialog()

We are seeing a change in Outlook with one of actions (“Help”) that stopped working on the web client only.
This action simply calls a js that opens a web page in a displayDialog() but it’s uiless in the sense that there’s no pane.
The other action (“Sign”) works ok but it launches a pane that does this.
Both of them work fine on the rich client (at least the version I use).
I wonder if there has been in recent changes in the requirements or the way this works?
We’re not seeing any error messages, just nothing happens after the prompt saying that the add-in is doing something.
We did some initial testing and noticed that in chrome the dialog will sometimes appear briefly. Could you confirm that you are calling event.completed() in the eventhandler of EventType.DialogEventReceived? event.completed() must be called in the DialogEventReceived handler otherwise the dialog will be closed prematurely.
Office.context.ui.displayDialogAsync(url, dialogOptions, function(result) {
// In the callback, save the dialog object
dialog = result.value;
// Add an event handler for messages sent via messageParent
dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogMessageReceived, receiveMessage);
// Add an event handler for events from the platform (like closing the dialog, etc.)
dialog.addEventHandler(Microsoft.Office.WebExtension.EventType.DialogEventReceived, dialogClosed);
});

What can you do in CoreBluetooth background delegate calls?

I am using Core Bluetooth in my project. I have included Session Backgrounding to avail its background mode functionality. I have observed that the delegate for peripheral disconnection,
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;
gets called in the background mode. However any code I write in this method is not executed except for NSLogs. Can somebody explain exactly what kind of code can be executed here?
My aim is to send this disconnection notification to my server.
Ok it seems it was some issue at my end. According the the documentation your app is woken (in the background) for around 10 seconds when it gets a bluetooth related delegate call.
You can use this time to perform any non view updating task and even request for additional time using beginBackgroundTaskWithExpirationHandler.
My code looks like this.
if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) {
[self sendEmailInBackground:peripheral]; //Code to send a server request
return;
}
and its working in the background mode. This also works when the phone is in lock state.

Session expires in embedded IWebBrowser2 upon opening another embedded IWebBrowser2 for NewWindow3 handling

I am working on a multi-threaded WTL-based application that opens multiple browser windows, each with its own embedded IWebBrowser2 instance for the browsing, and each in a separate UI thread.
In response to NewWindow3, I open a new browser-window, and return the new window's IWebBrowser2->get_Application() which returns an IDispatchPtr.
While the popup does open the desired site, the session in the original window, from which this popup was opened, EXPIRES - any further navigation in that original window takes be back to the login page!
Some points that I thought may be important for anyone to help me -
This happens ONLY when the NewWindow3 is fired, with a non-empty bstrUrlContext (the 3rd parameter containing the originating URL)
As part of the NewWindow3 processing, the following done -
Creation of the new IWebBrowser2-embedding window, Create()'ed with zWindowName set to the value of the bstrUrlContext parameter
The returned IDispatch pointer is retrieved from IWebBrowser2->get_Application()
This issue has been resolved.
I had to create the IWebBrowser2-embedding window with an empty-string (_T("")) WindowName.
And had to ensure creation of the IWebBrowser2 control by invoking CAxWindow::CreateControl() in the window's OnCreate() handler (for WM_CREATE)
Thanks

Subscribing to Apple events in Qt

Following the the code linked from here: Trap click event on dock icon using Qt on Mac, I tried to call the following method directly in my QApplication's constructor to receive notification of dock icon click events:
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler: m_dockIconClickEventHandler
andSelector: #selector(handleDockClickEvent:withReplyEvent:)
forEventClass: kCoreEventClass
andEventID: kAEReopenApplication];
If I call it directly, I do not receive notifications of this event. However, if I call it using QTimer::singleShot with a delay of, say, 5000 ms, I receive the notifications just fine.
Also, according to the Qt documentation, "A QTimer with a timeout interval of 0 will time out as soon as all the events in the window system's event queue have been processed." So I tried 0 ms, but that didn't work. 1 or above seems to.
Why do I need to wait and what is a better way to handle this situation than delaying for n ms?
When your application exec() is called, Qt sets its own event handlers, so your handler is overriden.
You may use in your constructor
connect(this, SIGNAL(setupDockEventMonitor()), SLOT(onSetupDockEventMonitor()), Qt::QueuedConnection);
emit setupDockEventMonitor();
And in onSetupDockEventMonitor() do install this event handler.

Show a Dialog Box from non event thread

I need to show a Dialog box, from an app started via an alternate entry point, when a push message arrives.
To do this I need to create an Application instance from the alternate entry point and listen for incoming push.
The problem is when I extend my application class from UiApplication, and call enterEventDispatcher() from the alternate entry point it shows an application icon in running applications forever.
I need to listen for push messages and alert user by a dialog without having an application icon.
So is there any way I can show a dialog from an alternate entry point without a UI event thread?
You can use global dialog. Just use this code.
synchronized (Application.getEventLock()) {
UiEngine ui = Ui.getUiEngine();
Screen screen = new Dialog(Dialog.D_OK, "Look out!!!", Dialog.OK,
Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),
Manager.VERTICAL_SCROLL);
ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

Resources