Commit eb9067bee6f1cacd5222b0c018acaacdd6160677

Authored by Perry Werneck
1 parent fd4606e2

Adding option to get the entire terminal window as selection.

src/include/lib3270/selection.h
... ... @@ -190,11 +190,12 @@
190 190 *
191 191 * @param hSession Session handle.
192 192 * @param cut Non zero to clear selected contents.
  193 + * @param all Non zero to get entire terminal, zero to get only the selected rectangle.
193 194 *
194 195 * @return NULL on error (sets errno), pointer to a rectangle containing the selected area (release it with lib3270_free).
195 196 *
196 197 */
197   - LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cut);
  198 + LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cut, int all);
198 199  
199 200 /**
200 201 * @brief Get bitmasked flag for the current selection.
... ...
src/selection/get.c
... ... @@ -144,11 +144,21 @@ LIB3270_EXPORT char * lib3270_cut_selected(H3270 *hSession)
144 144 return lib3270_get_selected_text(hSession,0,LIB3270_SELECTION_CUT);
145 145 }
146 146  
147   -LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cut)
  147 +LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cut, int all)
148 148 {
  149 + if(check_online_session(hSession))
  150 + return NULL;
  151 +
149 152 // Get block size
150 153 unsigned int row, col, width, height;
151   - if(lib3270_get_selection_rectangle(hSession, &row, &col, &width, &height))
  154 +
  155 + if(all)
  156 + {
  157 + row = col = 0;
  158 + width = lib3270_get_width(hSession);
  159 + height = lib3270_get_height(hSession);
  160 + }
  161 + else if(lib3270_get_selection_rectangle(hSession, &row, &col, &width, &height))
152 162 {
153 163 return NULL;
154 164 }
... ...