Recent

Author Topic: Get window title under GTK2  (Read 3493 times)

Valicek1

  • New member
  • *
  • Posts: 8
Get window title under GTK2
« on: April 29, 2014, 11:19:01 am »
Hi, I'm trying to implement saving actual window title to my time tracking app. Under window, It's easy. I just get window handle and than title. But under Linux (Ubuntu, Debian), with GTK2 widgetset, I'm not able to code it in FPC. I can get handle of window, but don't know how to continue. I'm using tempolary solution with xdotool, but it's not really good solution. I have spent hours by looking into docs, googling and reading forums. Can you tell me if I am just blind or what I'm supposed to do?

Thank you for your patience, Valicek1

PS: I was programming few years in Delphi and Lazarus under windows, but I don't know much about gui programming under linux GUI...

zeljko

  • Hero Member
  • *****
  • Posts: 1764
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Get window title under GTK2
« Reply #1 on: April 29, 2014, 01:23:43 pm »
Isn't it enough for ask your TForm for Caption property (if you're using LCL) ?
If you want it in pure gtk then gtk_window_get_title() is what you're searching for.
Be aware that GdkWindow <> GtkWindow. eg. GdkWindow have setter gdk_window_set_title(), but there's no getter gdk_window_get_title(). GtkWindow have both (at least in gtk3).

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Get window title under GTK2
« Reply #2 on: April 29, 2014, 02:00:46 pm »
I think Valicek1 is after the titles of windows spawned by GUI apps running independently of his own tracking application.

zeljko

  • Hero Member
  • *****
  • Posts: 1764
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Get window title under GTK2
« Reply #3 on: April 29, 2014, 03:38:23 pm »
I think Valicek1 is after the titles of windows spawned by GUI apps running independently of his own tracking application.

oh, then under x11 he must use libx11 calls, not gtk2 and not qt.

Valicek1

  • New member
  • *
  • Posts: 8
Re: Get window title under GTK2
« Reply #4 on: May 02, 2014, 08:46:36 pm »
I'm sorry for I'm for bad formulation of my question - yes, of course, I'm looking for title of other opened application - for example chrome, firefox, lazarus, netbeans, terminal...

Thank you for your answers, I'll look for x11 library calls. I was hoping I'm able to do it in some multi-platform solution...


Valicek1

 

TinyPortal © 2005-2018